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

Site editor: fix padding and margin visualizer positioning #43971

Merged
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
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- `Popover`: enable auto-updating every animation frame ([#43617](https://github.com/WordPress/gutenberg/pull/43617)).
- `Popover`: improve the component's performance and reactivity to prop changes by reworking its internals ([#43335](https://github.com/WordPress/gutenberg/pull/43335)).
- `NavigatorScreen`: updated to satisfy `react/exhaustive-deps` eslint rule ([#43876](https://github.com/WordPress/gutenberg/pull/43876))
- `Popover`: fix positioning when reference and floating elements are both within an iframe ([#43971](https://github.com/WordPress/gutenberg/pull/43971))

### Enhancements

Expand Down
8 changes: 5 additions & 3 deletions packages/components/src/popover/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -416,10 +416,12 @@ const UnforwardedPopover = (
// document scrolls. Also update the frame offset if the view resizes.
useLayoutEffect( () => {
if (
// reference and floating are in the same document
// Reference and root documents are the same.
referenceOwnerDocument === document ||
// the reference's document has a view (i.e. window)
// and a frame element (ie. it's an iframe)
// Reference and floating are in the same document.
referenceOwnerDocument === refs?.floating?.current?.ownerDocument ||
ntsekouras marked this conversation as resolved.
Show resolved Hide resolved
// The reference's document has no view (i.e. window)
// or frame element (ie. it's not an iframe).
! referenceOwnerDocument?.defaultView?.frameElement
) {
frameOffsetRef.current = undefined;
Expand Down