-
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: PDF preview not working on mobile devices iOS and Android #46382
Comments
We could potentially hide the preview and show a direct link to the file instead? |
I am able to preview PDF files on my IOS, I am not sure if this is still relevant can you please check @sejas and @danielbachhuber |
@Thelmachido , only the first page of the PDF is visible, appearing like a stretched "screenshot". It doesn't offer a multipage preview, unlike the desktop version which allows users to view the entire embedded PDF. Additionally, there are issues with the background, making it challenging to discern the PDF's boundaries. I could reproduce this behavior today. I understand that this is the natural iOS behavior, but we can improve it by adding borders and a white background. And probably removing one button or allowing the Download button to actually download the PDF. |
The browserSupportsPdfs util function must be refactored to use the HTML Standard Note This method replaces a number of legacy methods of inferring support for inline viewing of PDF files. https://developer.mozilla.org/en-US/docs/Web/API/Navigator/pdfViewerEnabled That way, we can avoid relying on User Agents, and allow modern browsers to dictate the display of the PDF viewer. |
Description
Embedding a PDF file using the core/file block is not rendering an interactive preview on mobile devices.
Expected behavior
The PDF should be displayed as an embed with the ability to scroll through multi-page files, as it does on desktop. Alternatively, the whole preview could be hidden for mobile, displaying only the buttons to preview and download.
Actual behavior
The PDF only displays the first page using a distorted image, without the option to scroll through the rest of the pages. Additionally, the content is displayed against the site's background, ignoring the PDF's original background, making it hard to identify it as a "preview".
Possible solutions
iframe
seems to render the pdf preview, but the UX is not the best.Other notes
Step-by-step reproduction instructions
core/file
block.Screenshots, screen recording, code snippet
iOS with pink background
Environment info
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: