fix(web): typing with the composer unfocused reaches the composer again - #13404
deathemperor wants to merge 1 commit into
Conversation
The chat header's actions menu stays mounted while closed (pingdotgg#12453), and type-to-focus plus the right panel launcher's letter shortcuts bail on any [data-slot="menu-popup"] in the document, so both were dead on every thread. Qualify each popup slot with :is([data-open],[data-ending-style]), as the dialog entries already are. With that fixed, the first redirected key ended up after the next one: focusAt focused the bare DOM node, the browser put the caret at the start, and setTextSelection to the selection ProseMirror already stored was a no-op. editor.view.focus() writes the stored selection to the DOM. Fixes pingdotgg#13403 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a narrowly scoped keyboard-interaction bug fix that restores typing and shortcut handling around mounted-but-closed popups and preserves the editor's stored caret position. Active overlays remain protected, and no defaults, static-analysis suppressions, or sensitive areas are changed. You can add or adjust custom eligibility rules. Learn more. |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: pingdotgg/t3code/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughPopup selectors now require an open or ending state before they block composer input redirection or launcher shortcuts. The editor’s ChangesComposer type-to-focus
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: Merge Risk: ⚪ Minimal · up to Typing into the unfocused composer and using launcher shortcuts should work without a confirmed material regression; merge risk is minimal. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Fixes #13403.
What Changed
ChatView.tsx(TYPE_TO_FOCUS_FLOATING_LAYER_SELECTOR) andRightPanelTabs.tsx(LAUNCHER_SHORTCUT_BLOCKING_LAYERS): each popup slot now matches only when:is([data-open],[data-ending-style]), the same way the dialog entries are already written.ComposerPromptEditorTiptap.tsxfocusAt:editor.view.dom.focus({ preventScroll: true })becomeseditor.view.focus().Why
Type-to-focus stopped working: with nothing focused, typed keys never reach the composer.
MenuPopupmounted while closed. Both keydown guards bail whenever any[data-slot="menu-popup"]is in the document, so type-to-focus and the launcher's letter shortcuts were dead on every thread.hibecameih. The first key goes throughinsertTextAtEnd. The controlled layout effect stores the caret after it while the editor is unfocused. ThenfocusAtfocused the bare DOM node, the browser put the caret at the start, andsetTextSelectionto the already-stored position did nothing. ProseMirror'sview.focus()focuses without scrolling and writes the stored selection to the DOM. (Latent since feat(web): enable rich text composer by default #12160.)Verified in a dev server with real data, closed header menu in the DOM, nothing focused:
h,i→hi, caret at the end (before: nothing; with only fix 1:ih)hello: pressw,o→hello woUI Changes
No visual change; keyboard behavior only.
Checklist
Opus 5.5 (1M context), Claude Code.
Summary by CodeRabbit