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:
@@ -10,7 +10,8 @@ interface TerminalProps {
|
||||
isMobile?: boolean;
|
||||
onTerminalReady?: (
|
||||
sendData: (data: string) => void,
|
||||
connectionStatus: "connecting" | "connected" | "disconnected" | "error"
|
||||
connectionStatus: "connecting" | "connected" | "disconnected" | "error",
|
||||
focusInput: () => void
|
||||
) => void;
|
||||
}
|
||||
|
||||
@@ -196,7 +197,10 @@ export const TerminalComponent: React.FC<TerminalProps> = ({
|
||||
ws.send(data);
|
||||
}
|
||||
};
|
||||
onTerminalReadyRef.current(sendData, status);
|
||||
const focusInput = () => {
|
||||
hiddenInputRef.current?.focus();
|
||||
};
|
||||
onTerminalReadyRef.current(sendData, status, focusInput);
|
||||
}
|
||||
|
||||
// Visibility API for reconnection
|
||||
@@ -225,7 +229,10 @@ export const TerminalComponent: React.FC<TerminalProps> = ({
|
||||
wsRef.current.send(data);
|
||||
}
|
||||
};
|
||||
onTerminalReady(sendData, status);
|
||||
const focusInput = () => {
|
||||
hiddenInputRef.current?.focus();
|
||||
};
|
||||
onTerminalReady(sendData, status, focusInput);
|
||||
}
|
||||
}, [status, onTerminalReady]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user