From a893a6c793c075c220e22ce9d45f34664fa8ce72 Mon Sep 17 00:00:00 2001 From: ilhan orhan Date: Tue, 23 Mar 2021 12:21:50 +0200 Subject: [PATCH] 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 --- packages/main/src/Select.js | 2 +- packages/main/test/specs/Select.spec.js | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/main/src/Select.js b/packages/main/src/Select.js index 5ff9791ff8ca..26accdf3113b 100644 --- a/packages/main/src/Select.js +++ b/packages/main/src/Select.js @@ -341,7 +341,7 @@ class Select extends UI5Element { } get _isPickerOpen() { - return this.responsivePopover && this.responsivePopover.opened; + return !!this.responsivePopover && this.responsivePopover.opened; } async _respPopover() { diff --git a/packages/main/test/specs/Select.spec.js b/packages/main/test/specs/Select.spec.js index 72ee8d740524..9c87a03ca20c 100644 --- a/packages/main/test/specs/Select.spec.js +++ b/packages/main/test/specs/Select.spec.js @@ -332,7 +332,7 @@ 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"; @@ -340,8 +340,13 @@ describe("Select general interaction", () => { 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', () => {