Skip to content

Commit

Permalink
fix(ui5-select): set aria-expanded initially (#2991)
Browse files Browse the repository at this point in the history
We used to return undefined for aria-expanded upon initial rendering, causing the attribute to not render at all, now we always return boolean and the attribute is added with "false" on initial rendering.

FIXES: #2987
  • Loading branch information
ilhan007 authored Mar 23, 2021
1 parent 377c9bc commit 8353ac2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/main/src/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ class Select extends UI5Element {
}

get _isPickerOpen() {
return this.responsivePopover && this.responsivePopover.opened;
return !!this.responsivePopover && this.responsivePopover.opened;
}

async _respPopover() {
Expand Down
7 changes: 6 additions & 1 deletion packages/main/test/specs/Select.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,16 +332,21 @@ describe("Select general interaction", () => {
assert.ok(selectText.getHTML(false).indexOf(EXPECTED_SELECTION_TEXT2) !== -1, "Select label is correct.");
});

it("Tests aria-label and aria-labelledby", () => {
it("Tests aria-label, aria-labelledby and aria-expanded", () => {
const select1 = browser.$("#textAreaAriaLabel").shadow$(".ui5-select-label-root");
const select2 = browser.$("#textAreaAriaLabelledBy").shadow$(".ui5-select-label-root");
const EXPECTED_ARIA_LABEL1 = "Hello World";
const EXPECTED_ARIA_LABEL2 = "info text";

assert.strictEqual(select1.getAttribute("aria-label"), EXPECTED_ARIA_LABEL1,
"The aria-label is correctly set internally.");
assert.strictEqual(select1.getAttribute("aria-expanded"), "false",
"The aria-expanded is false by default.");

assert.strictEqual(select2.getAttribute("aria-label"), EXPECTED_ARIA_LABEL2,
"The aria-label is correctly set internally.");
assert.strictEqual(select2.getAttribute("aria-expanded"), "false",
"The aria-expanded is false by default.");
});

it('selected options are correctly disabled', () => {
Expand Down

0 comments on commit 8353ac2

Please sign in to comment.