Skip to content

Commit

Permalink
Merge pull request #242 from fire332/fix-ytaf-ui-click
Browse files Browse the repository at this point in the history
fix checkbox click in the YTAF config UI
  • Loading branch information
fire332 authored Dec 25, 2024
2 parents 4652116 + bd438c1 commit 98f6c61
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,14 @@ function createOptionsPanel() {
} else if (evt.keyCode === 13) {
// "OK" button

// 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) {
/**
* 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. Youtube uses the `Event` class instead of
* `KeyboardEvent` so we check for that.
* See issue #143 and #200 for context.
*/
if (evt instanceof KeyboardEvent) {
document.activeElement.click();
}
} else if (evt.keyCode === 27) {
Expand Down

0 comments on commit 98f6c61

Please sign in to comment.