diff --git a/packages/block-editor/src/utils/dom.js b/packages/block-editor/src/utils/dom.js index bfdce60b9f0060..9c2e813ef742b6 100644 --- a/packages/block-editor/src/utils/dom.js +++ b/packages/block-editor/src/utils/dom.js @@ -96,11 +96,26 @@ function isElementVisible( element ) { return false; } - return element.checkVisibility( { - opacityProperty: true, - contentVisibilityAuto: true, - visibilityProperty: true, - } ); + // Older browsers, e.g. Safari < 17.4 may not support the `checkVisibility` method. + if ( element.checkVisibility ) { + return element.checkVisibility?.( { + opacityProperty: true, + contentVisibilityAuto: true, + visibilityProperty: true, + } ); + } + + const style = viewport.getComputedStyle( element ); + + if ( + style.display === 'none' || + style.visibility === 'hidden' || + style.opacity === '0' + ) { + return false; + } + + return true; } /**