mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 1378016 - Fix keyboard navigation and selection on 'recent bookmarks'. r=Gijs
MozReview-Commit-ID: GJ7vRPz8zuo --HG-- extra : rebase_source : b8a212cd174f81994e3cdb5adc4226b5dfc531d3
This commit is contained in:
parent
0be9924b76
commit
e2a35da326
@ -1022,14 +1022,12 @@ this.PanelMultiView = class {
|
||||
buttons = navMap.buttons = this._getNavigableElements(view);
|
||||
// Set the 'tabindex' attribute on the buttons to make sure they're focussable.
|
||||
for (let button of buttons) {
|
||||
if (button.classList.contains("subviewbutton-back"))
|
||||
continue;
|
||||
// If we've been here before, forget about it!
|
||||
if (button.hasAttribute("tabindex"))
|
||||
break;
|
||||
if (!button.classList.contains("subviewbutton-back") &&
|
||||
!button.hasAttribute("tabindex")) {
|
||||
button.setAttribute("tabindex", 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!buttons.length)
|
||||
return;
|
||||
|
||||
@ -1078,14 +1076,21 @@ this.PanelMultiView = class {
|
||||
break;
|
||||
// Fall-through...
|
||||
}
|
||||
case "Space":
|
||||
case "Enter": {
|
||||
let button = buttons[navMap.selected];
|
||||
if (!button)
|
||||
break;
|
||||
stop();
|
||||
// Unfortunately, 'tabindex' doesn't not execute the default action, so
|
||||
|
||||
// Unfortunately, 'tabindex' doesn't execute the default action, so
|
||||
// we explicitly do this here.
|
||||
button.click();
|
||||
// We are sending a command event and then a click event.
|
||||
// This is done in order to mimic a "real" mouse click event.
|
||||
// The command event executes the action, then the click event closes the menu.
|
||||
button.doCommand();
|
||||
let clickEvent = new event.target.ownerGlobal.MouseEvent("click", {"bubbles": true});
|
||||
button.dispatchEvent(clickEvent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user