-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
File Block: Defer hiding PDF embeds for unsupported browsers until the page has loaded #50113
Conversation
Size Change: +26 B (0%) Total Size: 1.37 MB
ℹ️ View Unchanged
|
Flaky tests detected in 915c7d5. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4814442013
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven’t had a chance to test but code changes look like expected 👍
I tested it locally and it works correctly. |
What?
Instead of calling
hidePdfEmbedsOnUnsupportedBrowsers
immediately when the File block's view script loads (in thehead
), wait until the DOM has loaded.Why?
Currently all of a block's view scripts are loaded in the
head
(see Core-54018). The Navigation block's view scripts run their logic at the windowload
event (cf. #42394 (comment)). The File block, however, does not use any such event listener to run itshidePdfEmbedsOnUnsupportedBrowsers
logic. This means that currently no PDF embeds are being hidden on unsupported browsers. I'm surprised that this hasn't been noticed before now, since such embeds don't work on mobile devices. For example, see the WordPress.com Support Page for Embed a PDF File in Chrome for Android:Testing Instructions