Browse Source

Capture every space press

Otherwise spacebar does not work if focus is on the sound input or a
bookmark link (in development). We will need to revise the approach if
we make any text input fields.
tags/v0.1.0
Gerben 4 years ago
parent
commit
09b952e80e
1 changed files with 4 additions and 2 deletions
  1. +4
    -2
      app/audio-player/contentscript.js

+ 4
- 2
app/audio-player/contentscript.js View File

@@ -40,11 +40,13 @@ export default async function init() {
} }


document.body.addEventListener('keydown', event => { document.body.addEventListener('keydown', event => {
if (event.target !== document.body) return;
// Pressing spacebar triggers play/pause.
if (event.code === 'Space') { if (event.code === 'Space') {
playpause(); playpause();
event.stopPropagation();
event.preventDefault();
} }
});
}, { capture: true });


// Load the file // Load the file
await playlist.load([{ await playlist.load([{


Loading…
Cancel
Save