fix: keep virtual keyboard open when tapping special keys

- Use onPointerDown with preventDefault() instead of onClick
- Add onKeepFocus callback to SpecialKeysStrip and SpecialKeysPanel
- Expose focusInput via onTerminalReady in TerminalComponent
- MobileTerminalWrapper passes focus callback to keep keyboard open
This commit is contained in:
Fusion
2026-05-24 11:57:55 +02:00
parent aea1ff95f6
commit 7e0df57f8c
4 changed files with 42 additions and 15 deletions
+11 -8
View File
@@ -5,6 +5,7 @@ interface SpecialKeysPanelProps {
onSend: (data: string) => void;
isOpen: boolean;
onClose: () => void;
onKeepFocus?: () => void;
}
const EXPANDED_KEYS: { key: SpecialKey; label: string }[] = [
@@ -36,11 +37,19 @@ export const SpecialKeysPanel: React.FC<SpecialKeysPanelProps> = ({
onSend,
isOpen,
onClose,
onKeepFocus,
}) => {
const { sendKey } = useSpecialKeys({ onSend });
if (!isOpen) return null;
const handlePointerDown = (e: React.PointerEvent, key: SpecialKey) => {
e.preventDefault();
sendKey(key);
onClose();
onKeepFocus?.();
};
return (
<div className="special-keys-panel-overlay" onClick={onClose}>
<div
@@ -52,10 +61,7 @@ export const SpecialKeysPanel: React.FC<SpecialKeysPanelProps> = ({
<button
key={key}
className="special-key-button"
onClick={() => {
sendKey(key);
onClose();
}}
onPointerDown={(e) => handlePointerDown(e, key)}
type="button"
>
{label}
@@ -68,10 +74,7 @@ export const SpecialKeysPanel: React.FC<SpecialKeysPanelProps> = ({
<button
key={key}
className="special-key-button"
onClick={() => {
sendKey(key);
onClose();
}}
onPointerDown={(e) => handlePointerDown(e, key)}
type="button"
>
{label}