fix(player): Escape coordination, focused-Space, light-theme menus (U-C, U-3.1.4, U-3.3.12)

Three player/overlay interaction fixes (PlexPlayer changes share a file, hence one
commit):
- U-C (Escape double-close): useDismiss's Escape now stopPropagation()s (its document
  listener bubbles before a player's window listener, so one Escape closes only the
  popover, not the popover AND the player). Modal exports modalCount(); both players'
  Escape defers when a Modal is open above them, so Escape closes the dialog, not the
  player under it and then the dialog.
- U-3.1.4: PlexPlayer's Space now defers to a focused BUTTON/A (e.g. "Skip intro")
  instead of toggling playback — matching PlayerModal.
- U-3.3.12: the audio/subtitle menus used theme-adaptive glass-menu + forced
  text-white (white-on-white in light theme); they now use the player's own explicit
  dark panel (border-white/15 + bg-neutral-900/95), readable in both themes.
This commit is contained in:
2026-07-21 22:29:40 +02:00
parent f590be2bef
commit 94dfa6a34b
4 changed files with 29 additions and 3 deletions
+4
View File
@@ -23,6 +23,7 @@ import {
} from "lucide-react";
import Avatar from "./Avatar";
import AddToPlaylist from "./AddToPlaylist";
import { modalCount } from "./Modal";
import DownloadButton from "./DownloadButton";
import { api, type Video } from "../lib/api";
import {
@@ -375,6 +376,9 @@ export default function PlayerModal({
if (e.key === "Escape") {
// In fullscreen, let the browser's Esc exit fullscreen only — don't also close the modal.
if (document.fullscreenElement) return;
// Defer to any Modal opened above the player (e.g. the download dialog): its Escape closes
// it, ours would otherwise also fire and close the player underneath it (U-C).
if (modalCount() > 0) return;
onClose();
return;
}