Bug 1506503: PanelMultiView: Automatically focus the first item if a panel is opened via the keyboard.
47 bytes, text/x-phabricator-request
|Details | Review|
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 email@example.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
You need to log in before you can comment on or make changes to this bug.