Skip to content

fix(web): typing with the composer unfocused reaches the composer again - #13404

Open
deathemperor wants to merge 1 commit into
pingdotgg:mainfrom
deathemperor:fix/type-to-focus-closed-popups
Open

deathemperor wants to merge 1 commit into
pingdotgg:mainfrom
deathemperor:fix/type-to-focus-closed-popups

Conversation

@deathemperor

@deathemperor deathemperor commented Sep 24, 2026 •

Copy link
Copy Markdown

Fixes #13403.

What Changed

  • ChatView.tsx (TYPE_TO_FOCUS_FLOATING_LAYER_SELECTOR) and RightPanelTabs.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.tsx focusAt: editor.view.dom.focus({ preventScroll: true }) becomes editor.view.focus().

Why

Type-to-focus stopped working: with nothing focused, typed keys never reach the composer.

  1. fix(web): keep narrow chat headers readable and aligned #12453 keeps the chat header's actions MenuPopup mounted 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.
  2. With (1) fixed, hi became ih. The first key goes through insertTextAtEnd. The controlled layout effect stores the caret after it while the editor is unfocused. Then focusAt focused the bare DOM node, the browser put the caret at the start, and setTextSelection to the already-stored position did nothing. ProseMirror's view.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:

  • empty composer: press h, i → hi, caret at the end (before: nothing; with only fix 1: ih)
  • composer holding hello : press w, o → hello wo

UI Changes

No visual change; keyboard behavior only.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Opus 5.5 (1M context), Claude Code.

Summary by CodeRabbit

  • Bug Fixes
    • Closed menus, dialogs, and other popups no longer interfere with chat-layer detection or block launcher letter shortcuts; open and closing popups continue to behave as before.
    • When focusing the prompt editor after an update, the caret now moves to the intended position instead of jumping to the start.

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>
@github-actions github-actions Bot added size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Sep 24, 2026
@macroscopeapp

macroscopeapp Bot commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 030f179

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.

@coderabbitai

coderabbitai Bot commented Sep 24, 2026

Copy link
Copy Markdown

Review in Change Stack →

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 configuration

Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: b72e25e1-9e7d-47ae-a78a-58c58a94d80e

📥 Commits

Reviewing files that changed from the base of the PR and between b2b43be and 030f179.

📒 Files selected for processing (3)
  • apps/web/src/components/ChatView.tsx
  • apps/web/src/components/ComposerPromptEditorTiptap.tsx
  • apps/web/src/components/RightPanelTabs.tsx

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

Popup selectors now require an open or ending state before they block composer input redirection or launcher shortcuts. The editor’s focusAt method now calls editor.view.focus().

Changes

Composer type-to-focus

Layer / File(s) Summary
Check popup state before blocking shortcuts
apps/web/src/components/ChatView.tsx, apps/web/src/components/RightPanelTabs.tsx
Popup selectors now match only when the popup is open or ending.
Focus the editor with its stored selection
apps/web/src/components/ComposerPromptEditorTiptap.tsx
focusAt now calls editor.view.focus() instead of focusing the DOM element directly.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: juliusmarminge

Merge Risk: ⚪ Minimal · up to 030f1

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)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the primary behavior fix: typing while the composer is unfocused reaches the composer again.
Description check ✅ Passed The description includes the required What Changed, Why, UI Changes, and Checklist sections. It explains the selector and focus changes, the cause, the expected behavior, and verification results. The…
Linked Issues check ✅ Passed The changes satisfy Issue #13403. ChatView.tsx and RightPanelTabs.tsx now block type-to-focus and launcher shortcuts only for popups with [data-open] or [data-ending-style]. Closed mounted pop…
Out of Scope Changes check ✅ Passed All changed files support Issue #13403. The selector changes remove false blocking from closed mounted popups. The editor focus change preserves the required caret position during type-to-focus. No un…
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Typing with the composer unfocused no longer goes to the composer

1 participant