PanelMultiView: Automatically focus the first item if a panel is opened via the keyboard

RESOLVED FIXED in Firefox 65

Status

()

enhancement
P1
normal
RESOLVED FIXED
6 months ago
6 months ago

People

(Reporter: Jamie, Assigned: Jamie)

Tracking

(Blocks 1 bug)

unspecified
Firefox 65
Points:
---

Firefox Tracking Flags

(firefox65 fixed)

Details

Attachments

(1 attachment)

(Assignee)

Description

6 months ago
We have specific code to focus the first item in the panel when the View site information (#identity-box) button is activated via the keyboard:
https://searchfox.org/mozilla-central/source/browser/base/content/browser-siteIdentity.js#821
Currently, the identity panel is the only popup panel which can be opened from the keyboard. However, bug 1436086 will allow all toolbar buttons to be reached and activated with the keyboard, which includes buttons to open the Firefox menu, Library popup, Page Actions popup, etc. To work well for keyboard and screen reader users, all of these should focus the first item in the panel.

These are all based on panelMultiView. The arguments passed to PanelMultiView.openPopup often include the event which triggered the popup. We can use this to detect keypress events and focus the first item for them.
(Assignee)

Comment 1

6 months ago
Previously, we had specific code to do this for the "View site information" button (#identity-box) when activated via the keyboard.
To work well for keyboard and screen reader users, all such popups (e.g. Firefox menu, Page Actions, etc.) should do this.
These are all based on panelMultiView.
The arguments passed to PanelMultiView.openPopup can include the event which triggered the popup.
We now use this to detect keypress events and focus the first item in the panel in that case.

Comment 3

6 months ago
I should point out that the current way these panels deal with focus has the disadvantage that it interferes with cut/copy/paste (because real focus moves, so the previously-focused text field and its selection state is unknown). I'm not sure if continuing in that direction and just accepting that this is broken is the best approach, or if we should rethink how the keyboard focus in these panels works.

x-ref bug 1489974.
Priority: -- → P1

Comment 4

6 months ago
Pushed by jteh@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/7949f2950122
PanelMultiView: Automatically focus the first item if a panel is opened via the keyboard. r=johannh,paolo

Comment 5

6 months ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/7949f2950122
Status: NEW → RESOLVED
Last Resolved: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 65
You need to log in before you can comment on or make changes to this bug.