[Webkit-unassigned] [Bug 219472] document.hasFocus() is true while URL bar has focus

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Dec 3 07:00:23 PST 2020


https://bugs.webkit.org/show_bug.cgi?id=219472

--- Comment #2 from jib at mozilla.com ---
Hi Alexey, it's the existing focus concept [1] extended to the top-level document's viewport, to describe current behavior in all browsers of firing the "blur" event when it loses focus (e.g. from a user leaving the browser window or app, or clicking the URL bar or another tab), and firing the "focus" event when it returns.

In the context of Safari, it's whatever triggers the "blur" event when e.g. the user clicks on Safari's URL bar today, and triggers the "focus" event when the user clicks back on the page afterwards.

The spec fails to capture this, even though it behaves consistently in all the browsers, including Safari, so we're documenting it. If you have concerns about how to specify this, please comment in https://github.com/whatwg/html/pull/6172


In the context of this bug, we found an anomaly in Safari compared to the other browsers wrt document.hasFocus().

Here's the STR code:

  window.onfocus = () => console.log("FOCUS");
  window.onblur = () => console.log("BLUR");
  setInterval(() => console.log(), 1000);

It seems reasonable that a document that receives "blur" no longer hasFocus(), since blur is the opposite of focus, and if for no other reason web compat with other browsers. 

[1] https://html.spec.whatwg.org/multipage/interaction.html#focus

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20201203/d8db02d7/attachment-0001.htm>


More information about the webkit-unassigned mailing list