fix(keys): a key a focused widget already handled fires no shortcut

The player's settings tabs switched tab on an arrow and prevented its default, yet the player's
window listener still sought the video 10 s. dispatch() now skips a defaultPrevented key for
every scope; listNav's private copy of the same guard goes.
This commit is contained in:
2026-09-27 17:28:10 +02:00
parent 8e09dd85f8
commit 2525a12264
3 changed files with 22 additions and 5 deletions
+2 -4
View File
@@ -320,10 +320,8 @@ function crossRow(from: NavList, item: HTMLElement, dy: -1 | 1): void {
}
function onKey(e: KeyboardEvent): void {
// A key a widget inside the item already handled is not ours: during a keyboard drag a playlist
// row's grip moves the row with the arrows (dnd-kit listens on the document, before this window
// listener, and prevents the default of every key it acts on).
if (e.defaultPrevented) return;
// A key a widget inside the item already handled is not ours (a keyboard drag's arrows): `dispatch`
// skips every such key, for every scope.
const arrow = (dx: -1 | 0 | 1, dy: -1 | 0 | 1) => (ev: KeyboardEvent) => {
if (move(dx, dy)) ev.preventDefault();
};