Skip to content

Commit

Permalink
Fixed spacebar scrolling page
Browse files Browse the repository at this point in the history
  • Loading branch information
pabloeltdev committed Nov 20, 2023
1 parent 218f8cc commit b6a434d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions components/control/Panel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,12 @@ onMounted(() => {
mediaSession.setActionHandler('previoustrack', skipBack)
mediaSession.setActionHandler('play', togglePlay)
mediaSession.setActionHandler('pause', togglePlay)
window.addEventListener('keypress', (evt: KeyboardEvent) =>
evt.code === 'Space' && togglePlay()
)
window.addEventListener('keypress', (evt: KeyboardEvent) => {
if (evt.code === 'Space') {
evt.preventDefault()
togglePlay()
}
})
if (playing.value) audio.value!.src = playing.value.mediaUrl!
})
</script>
Expand Down

0 comments on commit b6a434d

Please sign in to comment.