Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Popover: Fix issue with undefined getBoundingClientRect (#27445)
Fix an issue where the `Popover` component throws a runtime `TypeError: Cannot read property 'getBoundingClientRect' of undefined.` This may happen in WordPress if a Popover is rendered in an iframe. It's been observed by rendering a `BlockList` component containing `RichText` in an iframe 😵 The issue is that `instanceof` checks fail across iframe boundaries, where `anchorRef instanceof window.Element` fails because `anchorRef` when it _is_ an instance of Element in the frame but not `window.Element`. Instead of `instanceof` checks that fail across iframe boundaries, check for expected methods as the predicate.
- Loading branch information