ungoogled-software/ungoogled-chromium
View on GitHubFlag to prevent "Reload site?" dialog from stealing focus
Open
#2,458 opened on Aug 16, 2023
enhancementhelp wanted
Repository metrics
- Stars
- (18,674 stars)
- PR merge metrics
- (Avg merge 1d 11h) (9 merged PRs in 30d)
Description
Description
adding a flag to prevent the "reload site?" dialog from stealing focus
Who's implementing?
- I'm willing to implement this feature myself
The problem
Google Docs reloads itself randomly and loses its spot, I made a userscript that adds a beforeunload handler to try to allow me to cancel that, but the problem is that whenever it tries to reload, it pops up a dialog that steals focus so:
- if I am watching a fullscreen video I get yanked out of the video and shown the page that is attempting to reload
- if I am typing text, I type at 150+wpm so I cannot react fast enough to prevent my typing from dismissing the dialog / allowing the reload (which I do NOT want) - this is what just happened
- sometimes when I am using some non-Chromium application on my computer, Chromium will still steal focus to ask me if I want to allow this site to reload (rare)
Possible solutions
- trying to monkey-patch the reload out using a userscript (impossible because reassigning
location.reloadis blocked, and trying to assign tolocationcauses a navigation) - natively disallowing javascript from reloading the page whatsoever - probably too niche / nobody else would care about this
- disallowing this dialog from stealing focus - only treats a symptom, but at least can be useful to other people too (so may actually be worth implementing)
Alternatives
No response
Additional context
This is different from "Disable beforeunload" - that allows the page to reload without showing a dialog, but in this case I want the dialog to block the page from reloading - I just need the dialog to not randomly steal focus like a clickjacker.