Make keyboard shortcuts consistent (#20326)

* Make keyboard shortcuts consistent

* Cleanup

* Refactor prevent default to not require separate input

* Fix

* Implement escape for reviews

* Implement escape for explore

* Send content ref to get page changes for free
This commit is contained in:
Nicolas Mowen
2025-10-02 07:21:37 -06:00
committed by GitHub
parent 85ace6a6be
commit 2030809a6d
18 changed files with 231 additions and 122 deletions
@@ -60,7 +60,7 @@ export function GenericVideoPlayer({
["ArrowDown", "ArrowLeft", "ArrowRight", "ArrowUp", " ", "f", "m"],
(key, modifiers) => {
if (!modifiers.down || modifiers.repeat) {
return;
return true;
}
switch (key) {
@@ -92,6 +92,8 @@ export function GenericVideoPlayer({
}
break;
}
return true;
},
);
+3 -1
View File
@@ -144,7 +144,7 @@ export default function VideoControls({
const onKeyboardShortcut = useCallback(
(key: string | null, modifiers: KeyModifiers) => {
if (!modifiers.down) {
return;
return true;
}
switch (key) {
@@ -174,6 +174,8 @@ export default function VideoControls({
onPlayPause(!isPlaying);
break;
}
return true;
},
// only update when preview only changes
// eslint-disable-next-line react-hooks/exhaustive-deps