FN-5876: prevent mobile quick-entry autofocus
Avoid restoring focus to the new-task quick entry on mobile while preserving desktop behavior. - gate quick-entry autofocus and post-submit focus restoration behind a desktop-width check - add desktop and mobile coverage for initial focus behavior - add mobile coverage for avoiding focus restoration after successful task creation Files changed: .../dashboard/app/components/QuickEntryBox.tsx | 5 ++- .../components/__tests__/QuickEntryBox.test.tsx | 42 ++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) Fusion-Task-Id: FN-5876 Fusion-Task-Lineage: ede08207-6506-4f5e-8a6f-f7f1cbfb37c9
This commit is contained in:
@@ -16,6 +16,7 @@ import { NodeHealthDot } from "./NodeHealthDot";
|
||||
import { ProviderIcon } from "./ProviderIcon";
|
||||
|
||||
const STORAGE_KEY = "kb-quick-entry-text";
|
||||
const MOBILE_BREAKPOINT_PX = 768;
|
||||
const ALLOWED_IMAGE_TYPES = ["image/png", "image/jpeg", "image/gif", "image/webp"];
|
||||
|
||||
interface PendingImage {
|
||||
@@ -329,7 +330,9 @@ export function QuickEntryBox({ onCreate, addToast, tasks = [], availableModels,
|
||||
if (!isSubmitting && description === "" && textareaRef.current) {
|
||||
// Use setTimeout to ensure focus happens after React re-enables the textarea
|
||||
const focusTimeout = setTimeout(() => {
|
||||
textareaRef.current?.focus();
|
||||
if (typeof window !== "undefined" && window.innerWidth > MOBILE_BREAKPOINT_PX) {
|
||||
textareaRef.current?.focus();
|
||||
}
|
||||
}, 0);
|
||||
return () => clearTimeout(focusTimeout);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user