From 31c90dcae313391af3fc2b6ca09f5f7a43d3951c Mon Sep 17 00:00:00 2001 From: Roy Eden Date: Fri, 2 Dec 2022 16:36:42 -0300 Subject: [PATCH 1/2] Fixed event key with space --- src/js/listeners.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/js/listeners.js b/src/js/listeners.js index 38a344007..bec842250 100644 --- a/src/js/listeners.js +++ b/src/js/listeners.js @@ -65,14 +65,14 @@ class Listeners { return; } - if (event.key === 'Space' && matches(focused, 'button, [role^="menuitem"]')) { + if (event.key === ' ' && matches(focused, 'button, [role^="menuitem"]')) { return; } } // Which keys should we prevent default const preventDefault = [ - 'Space', + ' ', 'ArrowLeft', 'ArrowUp', 'ArrowRight', @@ -118,7 +118,7 @@ class Listeners { } break; - case 'Space': + case ' ': case 'k': if (!repeat) { silencePromise(player.togglePlay()); @@ -663,7 +663,7 @@ class Listeners { elements.buttons.settings, 'keyup', (event) => { - if (!['Space', 'Enter'].includes(event.key)) { + if (![' ', 'Enter'].includes(event.key)) { return; } From 6bb5a915136191c2b9ea44e90c3856216ebaca80 Mon Sep 17 00:00:00 2001 From: Roy Eden Date: Fri, 2 Dec 2022 17:00:23 -0300 Subject: [PATCH 2/2] Fixed spacebar `event.key` in `controls.js` --- src/js/controls.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/js/controls.js b/src/js/controls.js index 562820d8c..b15f8bb60 100644 --- a/src/js/controls.js +++ b/src/js/controls.js @@ -404,7 +404,7 @@ const controls = { 'keydown keyup', (event) => { // We only care about space and ⬆️ ⬇️️ ➡️ - if (!['Space', 'ArrowUp', 'ArrowDown', 'ArrowRight'].includes(event.key)) { + if (![' ', 'ArrowUp', 'ArrowDown', 'ArrowRight'].includes(event.key)) { return; } @@ -420,12 +420,12 @@ const controls = { const isRadioButton = matches(menuItem, '[role="menuitemradio"]'); // Show the respective menu - if (!isRadioButton && ['Space', 'ArrowRight'].includes(event.key)) { + if (!isRadioButton && [' ', 'ArrowRight'].includes(event.key)) { controls.showMenuPanel.call(this, type, true); } else { let target; - if (event.key !== 'Space') { + if (event.key !== ' ') { if (event.key === 'ArrowDown' || (isRadioButton && event.key === 'ArrowRight')) { target = menuItem.nextElementSibling; @@ -504,7 +504,7 @@ const controls = { menuItem, 'click keyup', (event) => { - if (is.keyboardEvent(event) && event.key !== 'Space') { + if (is.keyboardEvent(event) && event.key !== ' ') { return; }