Skip to content

Commit f4bb47c

Browse files
authored
fix(ui): Fix full-screen keyboard lock issues. (#535)
When the keyboard lock is supposed to be active (in full-screen mode), hitting the escape key (NOT long-pressing) should NOT dismiss the full-screen mode, and should send the Escape key through to the remote. - Added awaits to the browser calls that need to complete in order. - Cleaned up (mostly) duplicate code in the Absolute/Relative mouse handling - Ensure we don't overrun any existing keyboard lock or pointer lock - Release the keyboard lock when leaving full-screen - Per standards, we need to acquire the keyboard and pointer locks before entering full-screen or the user may get multiple messages about exiting. - Fixed all the missing/excess React dependencies. - Moved the pointer lock bar up so it is visible. - Somewhere along the way, the prompt to click the video when in relative-mouse-mode stopped being visible, restored it's visibility - Fixed all the "should be readonly" warnings.
1 parent a7693df commit f4bb47c

File tree

2 files changed

+116
-153
lines changed

2 files changed

+116
-153
lines changed

ui/src/components/VideoOverlay.tsx

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import LoadingSpinner from "@components/LoadingSpinner";
1010
import Card, { GridCard } from "@components/Card";
1111

1212
interface OverlayContentProps {
13-
children: React.ReactNode;
13+
readonly children: React.ReactNode;
1414
}
1515
function OverlayContent({ children }: OverlayContentProps) {
1616
return (
@@ -23,7 +23,7 @@ function OverlayContent({ children }: OverlayContentProps) {
2323
}
2424

2525
interface LoadingOverlayProps {
26-
show: boolean;
26+
readonly show: boolean;
2727
}
2828

2929
export function LoadingVideoOverlay({ show }: LoadingOverlayProps) {
@@ -57,8 +57,8 @@ export function LoadingVideoOverlay({ show }: LoadingOverlayProps) {
5757
}
5858

5959
interface LoadingConnectionOverlayProps {
60-
show: boolean;
61-
text: string;
60+
readonly show: boolean;
61+
readonly text: string;
6262
}
6363
export function LoadingConnectionOverlay({ show, text }: LoadingConnectionOverlayProps) {
6464
return (
@@ -91,8 +91,8 @@ export function LoadingConnectionOverlay({ show, text }: LoadingConnectionOverla
9191
}
9292

9393
interface ConnectionErrorOverlayProps {
94-
show: boolean;
95-
setupPeerConnection: () => Promise<void>;
94+
readonly show: boolean;
95+
readonly setupPeerConnection: () => Promise<void>;
9696
}
9797

9898
export function ConnectionFailedOverlay({
@@ -153,7 +153,7 @@ export function ConnectionFailedOverlay({
153153
}
154154

155155
interface PeerConnectionDisconnectedOverlay {
156-
show: boolean;
156+
readonly show: boolean;
157157
}
158158

159159
export function PeerConnectionDisconnectedOverlay({
@@ -207,8 +207,8 @@ export function PeerConnectionDisconnectedOverlay({
207207
}
208208

209209
interface HDMIErrorOverlayProps {
210-
show: boolean;
211-
hdmiState: string;
210+
readonly show: boolean;
211+
readonly hdmiState: string;
212212
}
213213

214214
export function HDMIErrorOverlay({ show, hdmiState }: HDMIErrorOverlayProps) {
@@ -310,8 +310,8 @@ export function HDMIErrorOverlay({ show, hdmiState }: HDMIErrorOverlayProps) {
310310
}
311311

312312
interface NoAutoplayPermissionsOverlayProps {
313-
show: boolean;
314-
onPlayClick: () => void;
313+
readonly show: boolean;
314+
readonly onPlayClick: () => void;
315315
}
316316

317317
export function NoAutoplayPermissionsOverlay({
@@ -361,18 +361,18 @@ export function NoAutoplayPermissionsOverlay({
361361
}
362362

363363
interface PointerLockBarProps {
364-
show: boolean;
364+
readonly show: boolean;
365365
}
366366

367367
export function PointerLockBar({ show }: PointerLockBarProps) {
368368
return (
369369
<AnimatePresence mode="wait">
370370
{show ? (
371371
<motion.div
372-
className="absolute -top-[36px] left-0 right-0 z-20 bg-white"
373-
initial={{ y: 20, opacity: 0, zIndex: 0 }}
374-
animate={{ opacity: 1, y: 0 }}
375-
exit={{ y: 43, zIndex: 0 }}
372+
className="flex w-full items-center justify-between bg-transparent"
373+
initial={{ opacity: 0, zIndex: 0 }}
374+
animate={{ opacity: 1, zIndex: 20 }}
375+
exit={{ opacity: 0, zIndex: 0 }}
376376
transition={{ duration: 0.5, ease: "easeInOut", delay: 0.5 }}
377377
>
378378
<div>

0 commit comments

Comments
 (0)