Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui5-popover): fix finding opener #10360

Merged
merged 3 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/main/src/Popover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ class Popover extends Popup {
}

if (openerHTMLElement && this._isUI5Element(openerHTMLElement)) {
return openerHTMLElement.getFocusDomRef();
return openerHTMLElement.getFocusDomRef() || openerHTMLElement;
}

return openerHTMLElement;
Expand Down
10 changes: 10 additions & 0 deletions packages/main/test/pages/PopoverInitiallyOpen.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,15 @@
</head>
<body onload="init()">
<ui5-button id="btn1">Open Popover</ui5-button>

<ui5-button id="openPopoverBtn1">Open Popover</ui5-button>
<ui5-popover id="popover1" opener="openPopoverBtn1" open>Content</ui5-popover>

<br />
<br />
<br />

<ui5-button id="openPopoverBtn2">Open Popover</ui5-button>
<ui5-popover id="popover2" open opener="openPopoverBtn2">Content</ui5-popover>
</body>
</html>
6 changes: 6 additions & 0 deletions packages/main/test/specs/Popover.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {
Expand Down
Loading