Skip to content

Commit

Permalink
fix(ui5-popover): document special cases
Browse files Browse the repository at this point in the history
  • Loading branch information
TeodorTaushanov committed Nov 21, 2023
1 parent 5143c8c commit ff7d00d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
9 changes: 4 additions & 5 deletions packages/main/src/Dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,10 @@ const ICON_PER_STATE: Record<ValueStateWithIcon, string> = {
*
* <code>import "@ui5/webcomponents/dist/Dialog";</code>
*
* <b>Note:</b> We don't recommend nesting popup-like components (<code>ui5-dialog</code>, <code>ui5-popover</code>) inside <code>ui5-dialog</code>.
* Ideally you should create all popups on the same level inside your HTML page and just open them from one another, rather than nesting them.
*
* <b>Note:</b> We don't recommend nesting popup-like components (<code>ui5-dialog</code>, <code>ui5-popover</code>) inside other components containing z-index.
* This might break z-index management.
* <b>Note: </b> We recommend placing popup-like components (<code>ui5-dialog</code> and <code>ui5-popover</code>)
* outside any other components. Preferably the popup-like components should be placed in
* a top level container. Otherwise, in some cases the parent elements can break
* the position and/or z-index management of the popup-like components.
*
* @constructor
* @author SAP SE
Expand Down
5 changes: 5 additions & 0 deletions packages/main/src/Popover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ type CalculatedPlacement = {
*
* <code>import "@ui5/webcomponents/dist/Popover.js";</code>
*
* <b>Note: </b> We recommend placing popup-like components (<code>ui5-dialog</code> and <code>ui5-popover</code>)
* outside any other components. Preferably the popup-like components should be placed in
* a top level container. Otherwise, in some cases the parent elements can break
* the position and/or the z-index management of the popup-like components.
*
* @constructor
* @author SAP SE
* @alias sap.ui.webc.main.Popover
Expand Down
6 changes: 4 additions & 2 deletions packages/main/test/specs/Popover.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ describe("Popover general interaction", () => {
const btnOpenPopover = await browser.$("#btnQuickViewCardOpener");
const btnMoveFocus = await browser.$("#btnMoveFocus");

await btnOpenPopover.scrollIntoView();

// assert - the opener is visible
assert.strictEqual(await btnOpenPopover.isDisplayedInViewport(), true,
"Opener is available.");
Expand Down Expand Up @@ -474,7 +476,7 @@ describe("Horizontal Alignment", () => {
await browser.$("#horizontalAlignBtn").click();
const popover = await browser.$("#popoverHorizontalAlign");
const opener = await browser.$("#targetOpener");

assert.ok(await isHorizontallyCentered(popover, opener), `Popover should be centered`);
});

Expand All @@ -492,7 +494,7 @@ describe("Horizontal Alignment", () => {
await browser.$("#horizontalAlignBtn").click();
const popover = await browser.$("#popoverHorizontalAlign");
const opener = await browser.$("#targetOpener");

assert.ok(await isHorizontallyRightAligned(popover, opener), `Popover should be right aligned`);
});

Expand Down

0 comments on commit ff7d00d

Please sign in to comment.