From c4903709728c4e9e6667782eded71ab858d3ef31 Mon Sep 17 00:00:00 2001 From: ilhan Date: Fri, 22 Jan 2021 11:13:27 +0200 Subject: [PATCH] fix(ui5-list): fix JS error on focusin FIXES: https://github.com/SAP/ui5-webcomponents/issues/2717 --- packages/main/src/List.js | 6 ++++-- packages/main/test/pages/List_test_page.html | 20 +++++++++++++++++++- packages/main/test/specs/List.spec.js | 8 ++++++++ 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/packages/main/src/List.js b/packages/main/src/List.js index e0908586dbf1..f5e6ac500290 100644 --- a/packages/main/src/List.js +++ b/packages/main/src/List.js @@ -586,12 +586,14 @@ class List extends UI5Element { isForwardElement(node) { const nodeId = node.id; + const afterElement = this.getAfterElement(); + const beforeElement = this.getBeforeElement(); - if (this._id === nodeId || this.getBeforeElement().id === nodeId) { + if (this._id === nodeId || (beforeElement && beforeElement.id === nodeId)) { return true; } - return this.getAfterElement().id === nodeId; + return afterElement && afterElement.id === nodeId; } onItemFocused(event) { diff --git a/packages/main/test/pages/List_test_page.html b/packages/main/test/pages/List_test_page.html index 580cb7db983a..ec2d3012bb1f 100644 --- a/packages/main/test/pages/List_test_page.html +++ b/packages/main/test/pages/List_test_page.html @@ -174,6 +174,20 @@

Test aria

+
+
+ Open popup with List + + +
+ +
+
+ + + Test + +
diff --git a/packages/main/test/specs/List.spec.js b/packages/main/test/specs/List.spec.js index 74b7d24dee10..c1ee1c56f6e8 100644 --- a/packages/main/test/specs/List.spec.js +++ b/packages/main/test/specs/List.spec.js @@ -303,4 +303,12 @@ describe("List Tests", () => { assert.strictEqual(input.getProperty("value"), "0", "item-click event is not fired when the button is pressed."); }); + + it("Popover with List opens without errors", () => { + const btnPopupOpener = $("#btnOpenPopup"); + const btnInListHeader = $("#btnInHeader"); + + btnPopupOpener.click(); + assert.strictEqual(btnInListHeader.isFocused(), true, "The List header btn is focused."); + }); });