Skip to content

Commit

Permalink
#8933: adds mousedown handler to solve document mousedown handler bug (
Browse files Browse the repository at this point in the history
…#8931)

* adds mousedown handler to solve document mousedown handler bug

* explain the mousedown event
  • Loading branch information
grahamlangford authored and fungairino committed Jul 26, 2024
1 parent 3c773cf commit d127d8b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/contentScript/focusCaptureDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ async function rawFocusCaptureDialog({
dialog.showModal();

const anyPromiseWillCloseTheDialog = [
// In Chrome 127.0.6533.73, the `chrome.sidePanel.open()` API started throwing user gesture errors
// when a message from the content script was sent to the background script.
// The root cause appears to be a registered mousedown handler on the document that sends a message
// Adding `mousedown` here ensures that the sidePanel.open call is made before the message for the mousedown
// handler on the document is sent.
// See https://issues.chromium.org/issues/355266358 for more details.
oneEvent(button, "mousedown"),
oneEvent(button, "click"),
oneEvent(dialog, "cancel"),
onContextInvalidated.promise,
Expand Down

0 comments on commit d127d8b

Please sign in to comment.