mirror of
https://github.com/koel/koel
synced 2024-11-10 06:34:14 +00:00
fix: Space bar triggers playback even on button roles
This commit is contained in:
parent
617fc9d0eb
commit
ecbc7de7fa
1 changed files with 9 additions and 1 deletions
|
@ -11,7 +11,15 @@ import { favoriteStore, queueStore } from '@/stores'
|
|||
const onKeyStroke = (key: KeyFilter, callback: (e: KeyboardEvent) => void) => {
|
||||
baseOnKeyStroke(key, e => {
|
||||
if (e.altKey || e.ctrlKey || e.metaKey) return
|
||||
if (e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement) return
|
||||
|
||||
if (e.target instanceof HTMLInputElement
|
||||
|| e.target instanceof HTMLTextAreaElement
|
||||
|| e.target instanceof HTMLButtonElement
|
||||
) return
|
||||
|
||||
const role = (e.target as HTMLElement).getAttribute('role')
|
||||
if (role === 'button' || role === 'checkbox') return
|
||||
|
||||
e.preventDefault()
|
||||
callback(e)
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue