From 45303f559e4b801631ffe1a0788d8293c5a357e7 Mon Sep 17 00:00:00 2001 From: Benny Powers Date: Thu, 30 Apr 2026 13:37:46 +0300 Subject: [PATCH 1/2] docs: improve docs page --- elements/pf-v5-tooltip/docs/pf-v5-tooltip.md | 66 +++++--------------- 1 file changed, 14 insertions(+), 52 deletions(-) diff --git a/elements/pf-v5-tooltip/docs/pf-v5-tooltip.md b/elements/pf-v5-tooltip/docs/pf-v5-tooltip.md index 1be3099d3d..2688f24a4b 100644 --- a/elements/pf-v5-tooltip/docs/pf-v5-tooltip.md +++ b/elements/pf-v5-tooltip/docs/pf-v5-tooltip.md @@ -1,132 +1,94 @@ {% renderInstallation %} {% endrenderInstallation %} {% renderOverview %} - ### Default + ### Default + Tooltip -
- This is some content -
{% endrenderOverview %} {% band header="Usage" %} ### Left Tooltip {% htmlexample %} - + Tooltip -
- This is some content -
{% endhtmlexample %} ### Left-Start Tooltip {% htmlexample %} - + Tooltip -
- This is some content -
{% endhtmlexample %} ### Left-End Tooltip {% htmlexample %} - + Tooltip -
- This is some content -
{% endhtmlexample %} ### Right Tooltip {% htmlexample %} - + Tooltip -
- This is some content -
{% endhtmlexample %} ### Right-Start Tooltip {% htmlexample %} - + Tooltip -
- This is some content -
{% endhtmlexample %} ### Right-End Tooltip {% htmlexample %} - + Tooltip -
- This is some content -
{% endhtmlexample %} ### Top Tooltip {% htmlexample %} - + Tooltip -
- This is some content -
{% endhtmlexample %} ### Top-Start Tooltip {% htmlexample %} - + Tooltip -
- This is some content -
{% endhtmlexample %} ### Top-End Tooltip {% htmlexample %} - + Tooltip -
- This is some content -
{% endhtmlexample %} ### Bottom Tooltip {% htmlexample %} - + Tooltip -
- This is some content -
{% endhtmlexample %} ### Bottom-Start Tooltip {% htmlexample %} - + Tooltip -
- This is some content -
{% endhtmlexample %} ### Bottom-End Tooltip {% htmlexample %} - + Tooltip -
- This is some content -
{% endhtmlexample %} {% endband %} From f99aaac77886576682dd0b4ee85affd0090e2d96 Mon Sep 17 00:00:00 2001 From: Benny Powers Date: Thu, 30 Apr 2026 13:38:04 +0300 Subject: [PATCH 2/2] fix(core): iframe support in floating dom controller --- .changeset/stale-moments-drive.md | 6 +++++ .../controllers/floating-dom-controller.ts | 23 ++++++++++--------- 2 files changed, 18 insertions(+), 11 deletions(-) create mode 100644 .changeset/stale-moments-drive.md diff --git a/.changeset/stale-moments-drive.md b/.changeset/stale-moments-drive.md new file mode 100644 index 0000000000..67bd1823f8 --- /dev/null +++ b/.changeset/stale-moments-drive.md @@ -0,0 +1,6 @@ +--- +"@patternfly/pfe-core": patch +--- + +`FloatingDOMController`: support usage within iframes + \ No newline at end of file diff --git a/core/pfe-core/controllers/floating-dom-controller.ts b/core/pfe-core/controllers/floating-dom-controller.ts index 024daf9389..527422ce12 100644 --- a/core/pfe-core/controllers/floating-dom-controller.ts +++ b/core/pfe-core/controllers/floating-dom-controller.ts @@ -839,7 +839,7 @@ function getOverflowAncestors( ): OverflowAncestors { const scrollableAncestor = getNearestOverflowAncestor(node); const isBody = scrollableAncestor === node.ownerDocument?.body; - const win = window; + const win = scrollableAncestor.ownerDocument?.defaultView ?? window; if (isBody) { const frameElement = getFrameElement(win); @@ -1269,8 +1269,8 @@ function getScale(element: Element): Coords { * @param element - The element to get visual offsets for * @returns Coordinates object with x and y offsets */ -function getVisualOffsets(): Coords { - const win = window; +function getVisualOffsets(element: Element): Coords { + const win = element.ownerDocument?.defaultView ?? window; if (!isWebKit() || !win.visualViewport) { return noOffsets; } @@ -1323,16 +1323,17 @@ function getBoundingClientRect( } } const visualOffsets = shouldAddVisualOffsets(isFixedStrategy, offsetParent) ? - getVisualOffsets() + getVisualOffsets(element) : createCoords(0); let x = (clientRect.left + visualOffsets.x) / scale.x; let y = (clientRect.top + visualOffsets.y) / scale.y; let width = clientRect.width / scale.x; let height = clientRect.height / scale.y; if (element) { - const win = window; - const offsetWin = offsetParent - && isElement(offsetParent) ? window : offsetParent; + const win = element.ownerDocument?.defaultView ?? window; + const offsetWin = offsetParent && isElement(offsetParent) ? + offsetParent.ownerDocument?.defaultView ?? window + : offsetParent; let currentWin = win; let currentIFrame = getFrameElement(currentWin); while (currentIFrame && offsetParent && offsetWin !== currentWin) { @@ -1349,7 +1350,7 @@ function getBoundingClientRect( height *= iframeScale.y; x += left; y += top; - currentWin = window; + currentWin = currentIFrame.ownerDocument?.defaultView ?? window; currentIFrame = getFrameElement(currentWin); } } @@ -1487,7 +1488,7 @@ function getDocumentRect(element: Element): Rect { * @returns Rect object with viewport dimensions and position */ function getViewportRect(element: Element, strategy: Strategy): Rect { - const win = window; + const win = element.ownerDocument?.defaultView ?? window; const html = getDocumentElement(element)!; const { visualViewport } = win; const width = visualViewport ? visualViewport.width : html.clientWidth; @@ -1552,7 +1553,7 @@ function getClientRectFromClippingAncestor( } else if (isElement(clippingAncestor)) { rect = getInnerBoundingClientRect(clippingAncestor, strategy); } else { - const visualOffsets = getVisualOffsets(); + const visualOffsets = getVisualOffsets(element); rect = { x: clippingAncestor.x - visualOffsets.x, y: clippingAncestor.y - visualOffsets.y, @@ -1768,7 +1769,7 @@ function getTrueOffsetParent(element: Element, polyfill?: (element: Element) => */ function getOffsetParent(element: Element, polyfill?: (element: Element) => Element | null): Element | Window { - const win = window; + const win = element.ownerDocument?.defaultView ?? window; if (isTopLayer(element)) { return win; }