-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
When must the focusing steps be run? #6729
Labels
Comments
This was referenced Jun 6, 2021
domenic
added a commit
that referenced
this issue
Oct 16, 2022
* Split it into two variants: one which runs synchronously on HTML element removal, and one which runs during "update the rendering". Closes #8225. * Be clear that the fixup does not cause any of the normal focus algorithms to run, and thus blur and change events do not fire. Also, delete the confusing "somehow unfocused without another element being explicitly focused" sentence. Fixes #3847. Fixes #6729.
3 tasks
domenic
added a commit
that referenced
this issue
Nov 4, 2022
* Split it into two variants: one which runs synchronously on HTML element removal, and one which runs during "update the rendering". Closes #8225. * After this split, only the "update the rendering" variant causes the normal focus algorithms to run, and thus blur and change events to fire. * Delete the confusing "somehow unfocused without another element being explicitly focused" sentence. Fixes #3847. Fixes #6729.
domenic
added a commit
that referenced
this issue
Jan 18, 2023
* Split it into two variants: one which runs synchronously on HTML element removal, and one which runs during "update the rendering". Closes #8225. * After this split, only the "update the rendering" variant causes the normal focus algorithms to run, and thus blur and change events to fire. * Delete the confusing "somehow unfocused without another element being explicitly focused" sentence. Fixes #3847. Fixes #6729.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Section 6.5.4 Processing model of the HTML specification defines focusing steps that user agents must immediately run "whenever the user attempts to move the focus" (emphasis mine). The same section also defines a focus fixup rule that specifies the behaviour when the focused area of the document stops being a focusable area. (For example, when an
<input type=text>
element becomes styled withdisplay: none
, it is no longer being rendered and hence no longer meets the requirements to be a focusable area.) I quote the normative part of the rule below:I believe this section and the non-normative notes beneath it have multiple areas of ambiguity:
Firstly, I perceive "removed from that Document in some way" to be a very imprecise use of language, likely to be confused with the concept of connectedness and the spec definition of node is removed from a document. I propose this phrasing should be replaced with a clear term or set of terms that better encompass the examples given in both the rule itself and the first accompanying note.
Secondly, it is ambiguous whether the focus fixup rule requires the focusing steps to be run. In my reading it certainly doesn't explicitly call for it, but if the second accompanying note is taken at face value, this would imply that the value of
document.activeElement
could change without either afocus
orblur
event being triggered. I propose that either the focusing steps be amended to mention non-user driven focus changes or the focus fixup rule be amended to state the focusing stepsmust
/must not
be called, or both.In my testing, when a focused input element stopped being rendered, browsers appeared to take inconsistent approaches:
In response to that finding, I also opened a corresponding Chrome bug yesterday: https://bugs.chromium.org/p/chromium/issues/detail?id=1214850
The text was updated successfully, but these errors were encountered: