[go: nahoru, domu]

Skip to content

Commit

Permalink
Bug 1898075 - Check for menu item in mousedown event. r=mtigley,crede…
Browse files Browse the repository at this point in the history
…ntial-management-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D212314
  • Loading branch information
Ryan Safaeian committed Jun 3, 2024
1 parent 030ddd1 commit c8653c3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion toolkit/components/satchel/megalist/content/MegalistView.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,12 @@ export class MegalistView extends MozLitElement {
},
{ capture: true }
);
popup.addEventListener("mousedown", e => e.preventDefault());
popup.addEventListener("mousedown", e => {
e.preventDefault();
if (e.target.classList != "menuItem") {
closeMenu();
}
});
for (const command of snapshotData.commands) {
if (command == "-") {
const separator = this.ownerDocument.createElement("div");
Expand All @@ -468,6 +473,7 @@ export class MegalistView extends MozLitElement {

const menuItem = this.ownerDocument.createElement("button");
menuItem.setAttribute("role", "menuitem");
menuItem.classList.add("menuItem");
menuItem.setAttribute("data-l10n-id", command.label);
menuItem.addEventListener("click", e => {
this.#messageToViewModel("Command", {
Expand Down

0 comments on commit c8653c3

Please sign in to comment.