diff --git a/ui/src/app/app.component.html b/ui/src/app/app.component.html index 9505f70..452842e 100644 --- a/ui/src/app/app.component.html +++ b/ui/src/app/app.component.html @@ -216,7 +216,9 @@ - + diff --git a/ui/src/app/app.component.ts b/ui/src/app/app.component.ts index b0ab674..9a65b70 100644 --- a/ui/src/app/app.component.ts +++ b/ui/src/app/app.component.ts @@ -180,10 +180,23 @@ export class AppComponent implements OnInit, OnDestroy { private onPlayerKeydown = (event: KeyboardEvent): void => { if (event.key === 'Escape' && this.playerUrl) { + // The native video controls (shadow DOM) would otherwise consume the + // key after a seek — stop it so the player closes cleanly instead of + // only highlighting the progress bar. + event.preventDefault(); + event.stopPropagation(); this.closePlayer(); } }; + onVideoFocusIn(event: FocusEvent): void { + // The native media controls live in a closed UA shadow root; once one of + // them (e.g. the progress bar after seeking) holds focus, the browser + // consumes Escape internally and no DOM keydown reaches the page. Blur + // the video so focus returns to the document and Escape can close it. + (event.currentTarget as HTMLVideoElement).blur(); + } + // ---------- Library (媒体库) ---------- setMode(mode: 'downloads' | 'library'): void {