Widget cards show a focus outline when their menu is opened with the mouse
Categories
(Firefox :: Widgets, defect)
Tracking
()
People
(Reporter: mconley, Assigned: mconley)
References
Details
Attachments
(1 external file)
Opening a widget card's menu with the mouse gives the whole card a focus outline, which stays until the menu closes. A focus outline should only appear for keyboard focus.
Steps to reproduce:
- Show a widget drawn with
moz-widgeton New Tab, such as the Wrexham AFC widget from bug 2087595. - Click the card's menu button with the mouse.
Expected: no focus outline on the card.
Actual: the card is outlined while its menu is open.
The outline comes from the :host(:focus-within) rule in moz-widget.css, which matches whenever anything inside the card has focus, however it got there. Clicking the menu button focuses it (a moz-button inside moz-widget-header), and the open panel-list in the menu slot keeps focus inside the card until it closes. The same rule is likely to outline the card while the user interacts with its framed content too, since a focused frame counts as focus inside the card.
The usual fix would be to show the outline for keyboard focus only, as :focus-visible does. That needs checking against where focus actually lands, though: the menu button sits inside moz-widget-header's shadow root and the frame inside moz-widget's, so a selector like :host(:has(:focus-visible)) may not see it.
Nina noticed this while reviewing D338387 for bug 2087595, the first widget to use these styles.
| Assignee | ||
Comment 1•15 days ago
|
||
Updated•15 days ago
|
Updated•7 days ago
|
Description
•