-
-
Notifications
You must be signed in to change notification settings - Fork 222
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
Implement workaround for print iframe removal on focus event #764
Conversation
Hey @sensasi-delight, thanks so much for this! I've been trying to think of situations where this might not work, or if it might cause problems for anything. Going to think about it for a few more days and then will merge if nothing comes up. Really appreciate you looking into this! |
Thank you for the response! Please let me know if there's anything I can clarify or improve further. I'm happy to help. |
Hello @MatthewHerbst , I was wondering if you were planning to merge this (as a beta version)? |
Hey! Apologies this has been delayed, I've been trying to find ways to break it. It seems like a simple change but event handlers have all sorts of weird behaviors so there's actually a lot of room for new edge cases to be introduced here. I will merge this and get it released as a beta in the next few hours |
I'm particularly concerned about the |
|
@sensasi-delight this seems to have caused a new issue, #779, where browsers that don't automatically return focus to the page will never have |
Dear @MatthewHerbst, First of all, I want to apologize for the unintended issue caused by this pull request. It did resolve the problem on Chrome for Android on my end, but I didn't test it on Vivaldi, and it’s entirely possible that Vivaldi behaves differently. I completely agree that the lack of focus return is poor UX. I’ve been thinking of a few alternative workarounds, such as leveraging the |
Hey, all good, it happens! Appreciate you responding so quick! I'll take a look at the new PR in a bit, thank you! |
This pull request introduces an important update to the
startPrint
function in thesrc/utils/startPrint.ts
file. The update implements a workaround to address the issue where the print iframe is removed immediately after the print dialog closes. This fixes the problem described in issue #187, where the iframe was being removed too early—before the print dialog appeared—causing the print preview to display the entire UI instead of the intended content.src/utils/startPrint.ts
: Added afocus
event listener to remove the print iframe after the print dialog closes, addressing the lack of a reliableafterprint
event in most browsers.