Skip to content

Commit

Permalink
Merge pull request #143 from throwaway96/fix-dup-click-evt-20240328
Browse files Browse the repository at this point in the history
Don't send duplicate event on mouse click
  • Loading branch information
throwaway96 authored Mar 30, 2024
2 parents 5b0ac15 + b62505d commit 0537775
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,13 @@ function createOptionsPanel() {
navigate(ARROW_KEY_CODE[evt.keyCode]);
} else if (evt.keyCode === 13) {
// "OK" button
document.querySelector(':focus').click();

// The YouTube app generates these "OK" events from clicks (including
// with the Magic Remote), and we don't want to send a duplicate click
// event for those. It seems isTrusted is only true for "real" events.
if (evt.isTrusted === true) {
document.activeElement.click();
}
} else if (evt.keyCode === 27) {
// Back button
showOptionsPanel(false);
Expand Down

0 comments on commit 0537775

Please sign in to comment.