From d040c32e50f99d634aadb31dff01b342ef32f59e Mon Sep 17 00:00:00 2001 From: Michael Ramos Date: Sun, 23 Aug 2026 14:17:52 -0700 Subject: [PATCH 1/2] fix: harden secondary inputs on mobile --- packages/editor/App.tsx | 2 + .../review-editor/components/AIConfigBar.tsx | 6 +- packages/review-editor/components/AITab.tsx | 1 + .../components/AnnotationToolbar.tsx | 2 + .../review-editor/components/AskAIInput.tsx | 1 + .../components/BaseBranchPicker.tsx | 7 +- .../components/CallFlowSearchControls.tsx | 7 + .../ExpandedCommentDialog.mobile.test.tsx | 1 + .../components/ExpandedCommentDialog.tsx | 1 + .../components/FileCommentBanner.tsx | 1 + .../components/PRCommentsTab.tsx | 1 + .../review-editor/components/PanelChrome.tsx | 3 + .../SuggestionModal.mobile.test.tsx | 83 +++++++ .../components/SuggestionModal.tsx | 208 ++++++++++-------- .../review-editor/components/ToolbarHost.tsx | 16 +- .../components/WorktreePicker.tsx | 9 +- .../components/guide/GuideEmptyState.tsx | 9 +- packages/ui/components/AgentControls.tsx | 7 +- packages/ui/components/AgentsTab.tsx | 30 ++- packages/ui/components/AttachmentsButton.tsx | 1 + packages/ui/components/CodeFilePopout.tsx | 5 +- packages/ui/components/ExportModal.tsx | 22 +- .../ui/components/ImageAnnotator/index.tsx | 15 +- .../ui/components/ImportModal.mobile.test.tsx | 131 +++++++++++ packages/ui/components/ImportModal.tsx | 45 ++-- .../MarkdownEditor.extensions.test.tsx | 2 + packages/ui/components/MarkdownEditor.tsx | 12 +- packages/ui/components/PlanHeaderMenu.tsx | 2 +- .../components/PopoutDialog.mobile.test.tsx | 43 ++++ packages/ui/components/PopoutDialog.tsx | 44 ++-- .../SearchableSelect.mobile.test.tsx | 77 +++++++ packages/ui/components/SearchableSelect.tsx | 4 +- packages/ui/components/blocks/TablePopout.tsx | 1 + packages/ui/components/core/textarea.tsx | 1 + .../goal-setup/GoalSetupSurface.tsx | 1 + .../ui/components/sidebar/FileBrowser.tsx | 1 + .../components/ui/mobile-foundation.test.tsx | 16 ++ packages/ui/components/ui/textarea.tsx | 1 + .../ui/hooks/useModalFocusLifecycle.test.tsx | 63 ++++++ packages/ui/hooks/useModalFocusLifecycle.ts | 56 +++++ .../ui/hooks/useViewportEnvironment.test.tsx | 21 ++ packages/ui/hooks/useViewportEnvironment.ts | 9 +- packages/ui/theme.css | 61 ++++- 43 files changed, 866 insertions(+), 163 deletions(-) create mode 100644 packages/review-editor/components/SuggestionModal.mobile.test.tsx create mode 100644 packages/ui/components/ImportModal.mobile.test.tsx create mode 100644 packages/ui/components/PopoutDialog.mobile.test.tsx create mode 100644 packages/ui/components/SearchableSelect.mobile.test.tsx create mode 100644 packages/ui/hooks/useModalFocusLifecycle.test.tsx create mode 100644 packages/ui/hooks/useModalFocusLifecycle.ts diff --git a/packages/editor/App.tsx b/packages/editor/App.tsx index d7ec25258..a15fa17b1 100644 --- a/packages/editor/App.tsx +++ b/packages/editor/App.tsx @@ -5716,6 +5716,7 @@ const App: React.FC = () => { isApiMode={isApiMode && !documentReadOnly} initialTab={initialExportTab} wrapCopiedAnnotations={wrapCopiedFeedback} + restoreFocusId={isCompactTouchLayout ? 'pn-compact-plan-options-trigger' : 'pn-plan-options-trigger'} /> {/* Import Modal */} @@ -5724,6 +5725,7 @@ const App: React.FC = () => { onClose={() => setShowImport(false)} onImport={importFromShareUrl} shareBaseUrl={shareBaseUrl} + restoreFocusId={isCompactTouchLayout ? 'pn-compact-plan-options-trigger' : 'pn-plan-options-trigger'} /> {/* Feedback prompt dialog */} diff --git a/packages/review-editor/components/AIConfigBar.tsx b/packages/review-editor/components/AIConfigBar.tsx index 250683d06..e508a78b6 100644 --- a/packages/review-editor/components/AIConfigBar.tsx +++ b/packages/review-editor/components/AIConfigBar.tsx @@ -2,6 +2,7 @@ import type React from 'react'; import { useState, useEffect, useRef } from 'react'; import { getProviderMeta } from '@plannotator/ui/components/ProviderIcons'; import { type AIProviderOption } from '@plannotator/ui/utils/aiProvider'; +import { shouldAutoFocusPassiveSearch } from '@plannotator/ui/hooks/useViewportEnvironment'; interface AIConfigBarProps { providers: AIProviderOption[]; @@ -162,16 +163,17 @@ export const AIConfigBar: React.FC = ({ {openMenu === 'model' && ( -
+
{models.length > 8 && (
setModelSearch(e.target.value)} - autoFocus + autoFocus={shouldAutoFocusPassiveSearch()} />
)} diff --git a/packages/review-editor/components/AITab.tsx b/packages/review-editor/components/AITab.tsx index c2ff795ab..234ee1399 100644 --- a/packages/review-editor/components/AITab.tsx +++ b/packages/review-editor/components/AITab.tsx @@ -309,6 +309,7 @@ const GeneralInput: React.FC<{