Skip to content

armgit / Piik

Public Imported from GitHub
0

Free, open-source screen sharing for private live streams with friends. Watch together in a browser or self-host Piik. 免费开源的私密屏幕共享,支持游戏直播、一起看电影与自部署。

fix(ui): preserve input focus when opening floating tools (#507)

AAA8f5927b30162
diff --git a/src/client/components/living/FloatingPanel.tsx b/src/client/components/living/FloatingPanel.tsx
index ec933bc2..2add4eb8 100644
--- a/src/client/components/living/FloatingPanel.tsx
+++ b/src/client/components/living/FloatingPanel.tsx
@@ -189,8 +189,9 @@ export function FloatingPanel({ id, trigger, title, icon, compact = false, ancho
onOpenChange?.(open, owner);
if (open) {
event.currentTarget.dataset.openedAt = String(performance.now());
- // Opening to read must not summon a phone's keyboard.
- event.currentTarget.focus({ preventScroll: true });
+ // Opening to read must not summon a phone's keyboard. The queued
+ // toggle must also preserve focus already placed inside the panel.
+ if (!event.currentTarget.contains(owner.activeElement)) event.currentTarget.focus({ preventScroll: true });
} else {
panelWindow.close();
if (event.currentTarget.contains(document.activeElement)) focusTrigger();