From eadfce68ea75dba61f36663950c0be85968b35fb Mon Sep 17 00:00:00 2001 From: Teodor Taushanov Date: Wed, 11 Dec 2024 13:32:16 +0200 Subject: [PATCH 1/2] fix(ui5-popover): fix finding opener --- packages/main/src/Popover.ts | 2 +- packages/main/test/pages/PopoverInitiallyOpen.html | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/main/src/Popover.ts b/packages/main/src/Popover.ts index d85eaaa45dcd..ec5faa744cb5 100644 --- a/packages/main/src/Popover.ts +++ b/packages/main/src/Popover.ts @@ -312,7 +312,7 @@ class Popover extends Popup { } if (openerHTMLElement && this._isUI5Element(openerHTMLElement)) { - return openerHTMLElement.getFocusDomRef(); + return openerHTMLElement.getFocusDomRef() || openerHTMLElement; } return openerHTMLElement; diff --git a/packages/main/test/pages/PopoverInitiallyOpen.html b/packages/main/test/pages/PopoverInitiallyOpen.html index 1b1a31b4ed54..fbd537c17893 100644 --- a/packages/main/test/pages/PopoverInitiallyOpen.html +++ b/packages/main/test/pages/PopoverInitiallyOpen.html @@ -36,5 +36,15 @@ Open Popover + + Open Popover + Content + +
+
+
+ + Open Popover + Content From 3f72fa1ac4b0f070f0c7b4fc6660f15e09617615 Mon Sep 17 00:00:00 2001 From: Teodor Taushanov Date: Wed, 11 Dec 2024 15:12:11 +0200 Subject: [PATCH 2/2] chore(ui5-popover): add tests --- packages/main/test/pages/PopoverInitiallyOpen.html | 4 ++-- packages/main/test/specs/Popover.spec.js | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/main/test/pages/PopoverInitiallyOpen.html b/packages/main/test/pages/PopoverInitiallyOpen.html index fbd537c17893..02ff830484a7 100644 --- a/packages/main/test/pages/PopoverInitiallyOpen.html +++ b/packages/main/test/pages/PopoverInitiallyOpen.html @@ -38,13 +38,13 @@ Open Popover Open Popover - Content + Content


Open Popover - Content + Content diff --git a/packages/main/test/specs/Popover.spec.js b/packages/main/test/specs/Popover.spec.js index 8e54a905c3ed..3fdb9dd1a4bb 100644 --- a/packages/main/test/specs/Popover.spec.js +++ b/packages/main/test/specs/Popover.spec.js @@ -475,6 +475,12 @@ describe("Initially opened", () => { it("test initial focus", async () => { assert.ok(await browser.$("#popoverBtn").matches(":focus"), "initial focus is correct"); }); + + it("test _open", async () => { + assert.ok(await browser.$("#popoverOpen")._open, "_open is set"); + assert.ok(await browser.$("#popover1")._open, "_open is set"); + assert.ok(await browser.$("#popover2")._open, "_open is set"); + }); }); describe("Acc", () => {