Fix spacebar being eaten by Vivaldi, and repeated arrow keys causing scrolling
This commit is contained in:
parent
602f16be8c
commit
0f6f912055
20
js/main.js
20
js/main.js
@ -544,11 +544,24 @@ class Player extends PrimaryView {
|
||||
key_target.addEventListener('keydown', ev => {
|
||||
if (! this.active)
|
||||
return;
|
||||
// Ignore IME composition and repeat events
|
||||
if (ev.isComposing || ev.keyCode === 229 || ev.repeat)
|
||||
return;
|
||||
this.using_touch = false;
|
||||
|
||||
// Ignore IME composition
|
||||
if (ev.isComposing || ev.keyCode === 229)
|
||||
return;
|
||||
|
||||
// For key repeat of keys we're listening to, we still want to preventDefault, but we
|
||||
// don't actually want to do anything. That would be really hard except the only keys
|
||||
// we care about preventDefaulting are action ones
|
||||
// TODO what if a particular browser does something for p/,/.?
|
||||
if (ev.repeat) {
|
||||
if (this.key_mapping[ev.key]) {
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (ev.key === 'p' || ev.key === 'Pause') {
|
||||
this.toggle_pause();
|
||||
return;
|
||||
@ -602,7 +615,6 @@ class Player extends PrimaryView {
|
||||
this.restart_level();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
// Don't scroll pls
|
||||
ev.preventDefault();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user