fix(voice): keep push to talk scoped to its input lifetime
Changing from one voice room to several changes the toggle target, not the shared held-key input. Retire the hold when its real callback or document changes, or on the existing keyup, blur and freeze boundaries. The Chrome hook comparison reproduces early release before the change and verifies both membership transitions plus all normal release paths; source types pass.
This commit is contained in:
1 parent
0d10d2e311
commit
338d92a4f5
1 file changed
+2
-2
@@ -113,7 +113,7 @@ export function useVoiceShortcuts(roomId: string | undefined, toggle: (action: V
|
||||
return () => owners.forEach(owner => owner.removeEventListener("keydown", keydown));
|
||||
}, [roomId, surface, pushToTalk]);
|
||||
useEffect(() => {
|
||||
if (!surface || !pushToTalk) return;
|
||||
if (!surface || !talk) return;
|
||||
const owners = [...new Set([document, surface])];
|
||||
const keyup = (event: KeyboardEvent) => onRelease(event);
|
||||
const release = () => onRelease();
|
||||
@@ -124,7 +124,7 @@ export function useVoiceShortcuts(roomId: string | undefined, toggle: (action: V
|
||||
inactive.forEach(stop => stop());
|
||||
release();
|
||||
};
|
||||
}, [roomId, surface, pushToTalk]);
|
||||
}, [surface, talk]);
|
||||
return { bindings, mac, save, reset: () => save(voiceShortcutDefaults(mac)), recording, setRecording, background,
|
||||
talking: pushToTalk && talking };
|
||||
}
|
||||
Reference in new issue
Block a user