1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Merge pull request #6496 from dmitrylyzo/skip-prevented-keyboard-event

This commit is contained in:
Bill Thornton 2025-01-31 10:18:30 -05:00 committed by GitHub
commit 5d8ab6a99b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 0 deletions

View file

@ -1246,12 +1246,14 @@ export default function (view) {
case 'ArrowLeft': case 'ArrowLeft':
case 'ArrowRight': case 'ArrowRight':
if (!e.shiftKey) { if (!e.shiftKey) {
e.preventDefault();
showOsd(nowPlayingPositionSlider); showOsd(nowPlayingPositionSlider);
nowPlayingPositionSlider.dispatchEvent(new KeyboardEvent(e.type, e)); nowPlayingPositionSlider.dispatchEvent(new KeyboardEvent(e.type, e));
} }
return; return;
case 'Enter': case 'Enter':
if (e.target.tagName !== 'BUTTON') { if (e.target.tagName !== 'BUTTON') {
e.preventDefault();
playbackManager.playPause(currentPlayer); playbackManager.playPause(currentPlayer);
showOsd(btnPlayPause); showOsd(btnPlayPause);
} }

View file

@ -125,6 +125,8 @@ export function isInteractiveElement(element) {
export function enable() { export function enable() {
const hasMediaSession = 'mediaSession' in navigator; const hasMediaSession = 'mediaSession' in navigator;
window.addEventListener('keydown', function (e) { window.addEventListener('keydown', function (e) {
if (e.defaultPrevented) return;
// Skip modified keys // Skip modified keys
if (e.ctrlKey || e.altKey || e.metaKey || e.shiftKey) return; if (e.ctrlKey || e.altKey || e.metaKey || e.shiftKey) return;