Skip to content

Commit 8353ac2

Browse files
authored
fix(ui5-select): set aria-expanded initially (#2991)
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
1 parent 377c9bc commit 8353ac2

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

packages/main/src/Select.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ class Select extends UI5Element {
341341
}
342342

343343
get _isPickerOpen() {
344-
return this.responsivePopover && this.responsivePopover.opened;
344+
return !!this.responsivePopover && this.responsivePopover.opened;
345345
}
346346

347347
async _respPopover() {

packages/main/test/specs/Select.spec.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -332,16 +332,21 @@ describe("Select general interaction", () => {
332332
assert.ok(selectText.getHTML(false).indexOf(EXPECTED_SELECTION_TEXT2) !== -1, "Select label is correct.");
333333
});
334334

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

341341
assert.strictEqual(select1.getAttribute("aria-label"), EXPECTED_ARIA_LABEL1,
342342
"The aria-label is correctly set internally.");
343+
assert.strictEqual(select1.getAttribute("aria-expanded"), "false",
344+
"The aria-expanded is false by default.");
345+
343346
assert.strictEqual(select2.getAttribute("aria-label"), EXPECTED_ARIA_LABEL2,
344347
"The aria-label is correctly set internally.");
348+
assert.strictEqual(select2.getAttribute("aria-expanded"), "false",
349+
"The aria-expanded is false by default.");
345350
});
346351

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

0 commit comments

Comments
 (0)