Switch PanelMultiView keyboard focus handling to use Element.focus() rather than Services.focus.setFocus()
Categories
(Firefox :: Toolbars and Customization, task, P2)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox129 | --- | fixed |
People
(Reporter: mstriemer, Assigned: ini)
Details
Attachments
(1 file)
In bug 1539984 PanelMultiView was updated to use Services.focus.setFocus() so that we can specify that the focus changed due to a keyboard event and show focus outline on :-moz-focusring/:focus-visible. Since then, bug 1711057 has updated our handling of Element.focus() calls so that if this is called during a keyboard event handler it automatically sets that the element was focused from the keyboard.
The distinction between these two calls comes into play when a custom element defines its own focus() method. For example in bug 1897212 our moz-toggle component is moving away from the shadow DOM delegatesFocus property since that has some unfortunate side effects like clicking on descriptive text focusing the toggle input. With that change however, PanelMultiView now attempts to focus the custom element host, rather than the toggle input since the focus() method is not called.
Since both Services.focus.setFocus() and Element.focus() will behave the same way in terms of showing the focusring we should prefer the Element.focus() call to that custom elements can specify where the focus should be moved within their shadow DOM.
| Assignee | ||
Comment 1•2 years ago
|
||
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Comment 3•2 years ago
|
||
| bugherder | ||
Description
•