Bug 1912403 - Remove inline keydown handler from navigator-toolbox. r=Gijs,places-reviewers,mak

Differential Revision: https://phabricator.services.mozilla.com/D224124
This commit is contained in:
Tom Schuster
2024-10-18 09:50:36 +00:00
parent f84b755d31
commit 05e3f046df
3 changed files with 11 additions and 13 deletions

View File

@@ -1583,16 +1583,6 @@ var BookmarkingUI = {
}
},
openLibraryIfLinkClicked(event) {
if (
((event.type == "click" && event.button == 0) ||
(event.type == "keydown" && event.keyCode == KeyEvent.DOM_VK_RETURN)) &&
event.target.localName == "a"
) {
PlacesCommandHook.showPlacesOrganizer("BookmarksToolbar");
}
},
_uninitView: function BUI__uninitView() {
// When an element with a placesView attached is removed and re-inserted,
// XBL reapplies the binding causing any kind of issues and possible leaks,

View File

@@ -505,8 +505,7 @@
<hbox id="personal-toolbar-empty" skipintoolbarset="true" removable="false" hidden="true" role="alert">
<description id="personal-toolbar-empty-description"
data-l10n-id="bookmarks-toolbar-empty-message"
onkeydown="BookmarkingUI.openLibraryIfLinkClicked(event);">
data-l10n-id="bookmarks-toolbar-empty-message">
<html:a data-l10n-name="manage-bookmarks" class="text-link" tabindex="0" role="link"/>
</description>
</hbox>

View File

@@ -235,7 +235,9 @@ document.addEventListener(
break;
case "personal-toolbar-empty-description":
BookmarkingUI.openLibraryIfLinkClicked(event);
if (isLeftClick && event.target.localName == "a") {
PlacesCommandHook.showPlacesOrganizer("BookmarksToolbar");
}
break;
case "home-button":
@@ -285,6 +287,7 @@ document.addEventListener(
#shopping-sidebar-button,
#urlbar-zoom-button,
#star-button-box,
#personal-toolbar-empty-description,
#home-button,
#tracking-protection-icon-container,
#identity-icon-box,
@@ -335,6 +338,12 @@ document.addEventListener(
);
break;
case "personal-toolbar-empty-description":
if (isLikeLeftClick && event.target.localName == "a") {
PlacesCommandHook.showPlacesOrganizer("BookmarksToolbar");
}
break;
case "home-button":
if (isLikeLeftClick) {
BrowserCommands.home(event);