Closed Bug 1540918 Opened 5 years ago Closed 5 years ago

Toolbar keyboard navigation: Focus goes to limbo when pop-up panel dismissed

Categories

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

defect

Tracking

()

RESOLVED FIXED
Firefox 68
Tracking Status
firefox68 --- fixed

People

(Reporter: Jamie, Assigned: Jamie)

References

(Blocks 1 open bug)

Details

(Keywords: access)

Attachments

(1 file)

STR:

  1. Press control+l to focus the Location bar.
  2. Tab to the Library button.
  3. Press space to activate it.
  4. Press escape to dismiss the Library menu.
    • Expected: Focus should return to the Library button (as in step 2).
    • Actual: Focus goes to limbo.

ToolbarKeyboardNavigator removes the tabindex (and thus focusability) of the toolbar button as soon as focus goes elsewhere. This is because we don't want clicking the button to focus it. That means that the PanelMultiView code which returns focus to the previously focused control won't work.

To fix this, we'll need some way to trigger ToolbarKeyboardNavigator's code to "force focus" to the button.

  1. We could just have PanelMultiView call ToolbarKeyboardNavigator, but this might be a bit ugly because of the coupling it introduces.
  2. Gijs suggested we could introduce an event which gets fired on the anchor (which should be the toolbar button). I just realised, though, that this will always fire even if the toolbar button wasn't focused, and we only want focus to be restored if the button was already focused.

Toolbar buttons are only made focusable when accessed via the keyboard.
As soon as they lose focus, their focusability is removed.
This is done so that clicking them doesn't focus them.
Previously, this meant that if a panel opened, focus couldn't be restored to the button like it should be when the panel was closed, as the button was no longer focusable.
To work around this, use the open="true" attribute set on the button when the panel opens.
If this is detected, focusability is not removed.
Once focus is restored after the panel closes, things continue as normal.
That is, when the button loses focus for some other reason, its focusability is removed.

Status: NEW → ASSIGNED
Priority: -- → P1
Pushed by jteh@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/97ab0fa26acf
When a panel is opened from the toolbar via the keyboard, restore focus to the toolbar button when the panel is closed. r=Gijs
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 68
QA Whiteboard: [qa-68b-p2]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: