fix: improve keyboard focus handling between inputs for mobile view

This commit is contained in:
Bohdan Triapitsyn
2025-12-28 13:43:53 +02:00
parent ef61c3ec6d
commit 0d27c0b6d5
3 changed files with 10 additions and 3 deletions
@@ -996,7 +996,7 @@ export const ChatInput: React.FC<ChatInputProps> = ({ onOpenSettings, scrollToBo
return (
<form onSubmit={handleSubmit} className="pt-0 pb-4 bottom-safe-area">
<form onSubmit={handleSubmit} className="pt-0 pb-2 md:pb-4 bottom-safe-area">
<StatusRow
isWorking={working.isWorking}
statusText={workingStatusText}
@@ -187,6 +187,13 @@ export const MainLayout: React.FC = () => {
const tagName = target.tagName;
const isInput = tagName === 'INPUT' || tagName === 'TEXTAREA' || tagName === 'SELECT';
if (isInput || target.isContentEditable) {
// Check if focus is moving to another input - if so, don't close keyboard
const related = event.relatedTarget as HTMLElement | null;
const relatedTag = related?.tagName;
const relatedIsInput = relatedTag === 'INPUT' || relatedTag === 'TEXTAREA' || relatedTag === 'SELECT' || related?.isContentEditable;
if (relatedIsInput) {
return;
}
forceKeyboardClosed();
}
};