Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Web-Facing Change PSA: Fix mouse focus for slotted elements in Shadow DOM

43 views
Skip to first unread message

Di Zhang

unread,
Dec 3, 2024, 9:18:56 AM12/3/24
to blink-dev
Contact emailsdizh...@chromium.org

Specificationhttps://dom.spec.whatwg.org/#concept-event-dispatch

Summary

Currently, mouse-triggered event will traverse up to the parent or shadow host to find fallback element to receive mouse focus. This doesn't work for slotted content, where we expect the fallback element to receive focus to be the assigned slot, instead of its parent. This is fixed by changing that step to traverse the Flat Tree.



Blink componentBlink>DOM>ShadowDOM

TAG reviewNone

TAG review statusNot applicable

Risks


Interoperability and Compatibility

WPT test: shadow-dom/focus/click-focus-slot-ancestor.html



Gecko: Shipped/Shipping

WebKit: Shipped/Shipping (https://bugs.webkit.org/show_bug.cgi?id=191694)

Web developers: No signals

Other signals:

Ergonomics

There are no ergonomic risk. This feature will fix which element will receive mouse focus for the specific case of a slotted content that cannot be mouse focused. It should not affect performance.



Activation

No, it will be enabled by default. There should be no polyfill necessary as this change should make Blink more interoperable with the other browsers.



Security

N/A. There are no security risk as it does not change whether an element can be focused. It changes the target of a mouse event fallback parent to match web standards and other browsers.



WebView application risks

Does this intent deprecate or change behavior of existing APIs, such that it has potentially high risk for Android WebView-based applications?

None



Debuggability

N/A. The same DevTools for mouse event handling and focus are applicable for this feature.



Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, ChromeOS, Android, and Android WebView)?Yes

This feature is for all platforms that uses HTML Shadow DOM and mouse click focus.



Is this feature fully tested by web-platform-tests?Yes

https://wpt.fyi/results/shadow-dom/focus/click-focus-slot-ancestor.html?label=experimental&label=master&aligned



Flag name on about://flagsMouseFocusFlatTreeParent

Finch feature nameNone

Non-finch justification

This is a bug fix.



Requires code in //chrome?False

Tracking bughttps://issues.chromium.org/issues/41420461

Sample links
https://codepen.io/JanMiksovsky/pen/OBjzeY?editors=1000#0

Estimated milestones
Shipping on desktop

133

Shipping on Android

133

Shipping on WebView

133


Anticipated spec changes

Open questions about a feature may be a source of future web compat or interop issues. Please list open issues (e.g. links to known github issues in the project for the feature specification) whose resolution may introduce web compat/interop risk (e.g., changing to naming or structure of the API in a non-backward-compatible way).

None

Link to entry on the Chrome Platform Statushttps://chromestatus.com/feature/5203351732748288?gate=5069763519447040

This intent message was generated by Chrome Platform Status.
Reply all
Reply to author
Forward
0 new messages