fix(chat): keep mobile send from losing focus

This commit is contained in:
2026-07-01 20:00:54 +08:00
parent 1cb031f793
commit 8586e87ab6
4 changed files with 52 additions and 5 deletions
+9
View File
@@ -51,6 +51,7 @@ interface KeyboardSnapshot {
export function useKeyboardHeight({
targetRef,
containerRef,
active = false,
onKeyboardDismiss,
}: UseKeyboardHeightOptions = {}): void {
@@ -172,6 +173,13 @@ export function useKeyboardHeight({
const handlePointerDown = (event: PointerEvent | TouchEvent) => {
const target = targetRef?.current;
const container = containerRef?.current;
if (event.target instanceof Node && container?.contains(event.target)) {
log.important("info", "[keyboard] keep active for input container tap", {
snapshot: formatSnapshot(readKeyboardSnapshot()),
});
return;
}
if (!target || event.target === target) return;
if (event.target instanceof Node && target.contains(event.target)) return;
release("outside-interaction");
@@ -215,6 +223,7 @@ export function useKeyboardHeight({
};
}, [
active,
containerRef,
targetRef,
]);
}
+1
View File
@@ -2,6 +2,7 @@ import type { RefObject } from "react";
export interface UseKeyboardHeightOptions {
targetRef?: RefObject<HTMLElement | null>;
containerRef?: RefObject<HTMLElement | null>;
active?: boolean;
onKeyboardDismiss?: () => void;
}