Skip to content

Commit

Permalink
🐛 Fix issue where moving mouse over command button after leaving woul…
Browse files Browse the repository at this point in the history
…d fire command
  • Loading branch information
kierandrewett committed Dec 21, 2023
1 parent ff168c5 commit 8164dd5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions components/commands/widgets/browser-command-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,10 @@ class BrowserCommandButton extends BrowserButton {
if (!isAllowedInput) return;
}

if (isMousedown) event.preventDefault();
if (isMousedown) {
event.preventDefault();
event.stopPropagation();
}

if (event.type == "mouseleave") {
window.addEventListener(
Expand All @@ -122,9 +125,10 @@ class BrowserCommandButton extends BrowserButton {
/** @type {KeyboardEvent} */ (event).code
);

this.toggleAttribute("mouseactive", isMousedown || isKeydown);
const canCommand =
(this.hasAttribute("mouseactive") && isMouseup) || isKeydown;

const canCommand = isMouseup || isKeydown;
this.toggleAttribute("mouseactive", isMousedown || isKeydown);

if (canCommand) {
this._doCommand.call(this, event);
Expand Down

0 comments on commit 8164dd5

Please sign in to comment.