You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 97b2758
Browse filesBrowse the repository at this point in the historyBrowse files
authored
Align focusing and unfocusing with HTML
Fix a regression introduced in 30.1.0 when focusing an element after removing the previously focused element. Removal leaves the document's viewport focused, represented internally by the Document. Treating that sentinel as the previous element caused spurious window blur and focusout events and exposed the Document as relatedTarget. Use focus chains and remove their common trailing entries so this transition fires only focus and focusin, with a null relatedTarget.
Implement shared focusing, unfocusing, and focus-update steps. Resolve non-focusable document elements to their viewports, redirect iframe targets to their content documents, and track focus transitions through ancestor documents. Unfocusing checks chain membership and current focusability before focusing the top-level viewport.
Recheck focusability before designating each new focused area, so targets removed or disabled by blur listeners do not become active. Apply selection changes before focus dispatch and stop clearing selection after blur, preserving selections established by event listeners.
Preserve the interoperable behavior of clearing old focus before blur dispatch and honoring focus changes made by blur listeners. These gaps in the written algorithm are tracked by whatwg/html#1569 and whatwg/html#12329. Follow the specified viewport resolution and top-level unfocusing behavior where browsers differ.
Document unsupported steps, including inertness, shadow-root focus delegation, rendering, and system focus. Documents continue to represent their viewports; asynchronous focus fixup remains separate.
Fixes#4344.
Fixes#4347.
Co-authored-by: Domenic Denicola <[email protected]>
Co-authored-by: codex <[email protected]>
// https://html.spec.whatwg.org/multipage/interaction.html#focusable-area, but also some of
13
-
// https://html.spec.whatwg.org/multipage/interaction.html#focusing-steps and some of
13
+
// https://html.spec.whatwg.org/multipage/interaction.html#focusable-area and
// The spec omits this reentrancy check. A focus change from a blur listener takes precedence,
261
+
// as required by WPT's `css/selectors/focus-within-focus-move.html` and implemented by browsers.
262
+
// See https://github.com/whatwg/html/issues/12329 and, for related `:focus-within` state issues,
"Default fill after inserting an XML element without the SVG namespace": [fail, https://github.com/jsdom/jsdom/issues/2688]
12
+
uievents/focusevents/hasfocus-focus-blur.html:
13
+
"document.hasFocus() returns true during internal focus shifts (blur and focus)": [fail, Need to fix document.hasFocus()]
0 commit comments