Closed Bug 1506503 Opened 2 years ago Closed 2 years ago

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

Categories

(Firefox :: Toolbars and Customization, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
Firefox 65
Tracking Status
firefox65 --- fixed

People

(Reporter: Jamie, Assigned: Jamie)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

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.
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.
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.
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
https://hg.mozilla.org/mozilla-central/rev/7949f2950122
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 65
You need to log in before you can comment on or make changes to this bug.