Skip to content

Commit 5cd5bba

Browse files
committed
bodge fix focusing
1 parent 7ff3cfa commit 5cd5bba

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/components/ConnectDevice.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,9 @@ export function ConnectDevice({
112112
className="bg-blue-500 text-white p-2 rounded-md"
113113
onClick={onClick}
114114
onKeyDown={(e) => {
115-
e.preventDefault();
115+
if (e.key !== "Tab") e.preventDefault();
116116
}}
117+
tabIndex={-1}
117118
>
118119
{device ? `${device.productName} Connected` : "Connect Device"}
119120
</button>

src/components/Game.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,21 @@ const Game = () => {
128128
onDisconnect={onDeviceDisconnect}
129129
device={device}
130130
/>
131-
<div style={{ width: "100%", height: "100%", position: "relative" }}>
131+
<div
132+
style={{
133+
width: "100%",
134+
height: "100%",
135+
position: "relative",
136+
display: "flex",
137+
}}
138+
>
132139
<div
133140
ref={containerRef}
134141
id="game-container"
135142
className="game-container"
136143
style={{ width: "100%", height: "100%" }}
144+
tabIndex={0}
145+
onClick={() => containerRef.current?.focus()}
137146
/>
138147
</div>
139148
</div>

0 commit comments

Comments
 (0)