Skip to content

fix(preview): let arrow keys seek video instead of switching files#5895

Merged
hacdias merged 1 commit intofilebrowser:masterfrom
Brumaire:fix/video-arrow-keys
Apr 11, 2026
Merged

fix(preview): let arrow keys seek video instead of switching files#5895
hacdias merged 1 commit intofilebrowser:masterfrom
Brumaire:fix/video-arrow-keys

Conversation

@Brumaire
Copy link
Copy Markdown
Contributor

@Brumaire Brumaire commented Apr 8, 2026

Description

When previewing a video in a folder containing more than one file, pressing the left/right arrow keys switches to the previous/next file instead of seeking the video. This makes it impossible to use the keyboard to seek videos in any folder with multiple items — single-video folders work because there is nothing to switch to, so the event falls through to video.js.

The root cause is in frontend/src/views/files/Preview.vue: the key handler unconditionally maps ArrowLeft / ArrowRight to prev() / next() without checking the current file type, so video.js never gets a chance to handle them.

Additional Information

This PR adds a small guard: when the current preview is a video (fileStore.req?.type === "video"), ArrowLeft and ArrowRight return early and the event falls through to video.js for seeking. Enter is preserved as an "advance to next file" shortcut so multi-video folders still have a keyboard way to switch, and Esc is unchanged.

Behavior summary:

Key Non-video preview Video preview (after this PR)
ArrowLeft prev file video.js seek backward
ArrowRight next file video.js seek forward
Enter next file next file (unchanged)
Esc close close (unchanged)

Related discussion: #4908 (video player improvements).

Checklist

  • I am aware the project is currently in maintenance-only mode.
  • I am aware that translations MUST be made through Transifex and that this PR is NOT a translation update.
  • I am making a PR against the master branch.
  • I am sure File Browser can be successfully built. (Built and verified locally; the patched image has been running healthy on my own deployment.)

@Brumaire Brumaire requested a review from a team as a code owner April 8, 2026 14:46
Copy link
Copy Markdown
Member

@hacdias hacdias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small and nice fix!

@hacdias hacdias merged commit 0fadf28 into filebrowser:master Apr 11, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants