ungoogled-software/ungoogled-chromium

Flag to prevent "Reload site?" dialog from stealing focus

Open

#2,458 创建于 2023年8月16日

在 GitHub 查看
 (0 评论) (0 反应) (0 负责人)Python (771 fork)batch import
enhancementhelp wanted

仓库指标

Star
 (18,674 star)
PR 合并指标
 (平均合并 1天 11小时) (30 天内合并 9 个 PR)

描述

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.reload is blocked, and trying to assign to location causes 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.

贡献者指南