Skip to content

fix(web): Mod+B toggles bold at a collapsed cursor when the sidebar toggle is remapped - #29445

Merged
juliusmarminge merged 13 commits into
mainfrom
fix/issue-29426
Nov 12, 2026
Merged

juliusmarminge merged 13 commits into
mainfrom
fix/issue-29426

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Problem

After moving sidebar.toggle off Mod+B, pressing Mod+B in the rich-text composer with nothing selected still does nothing. It should toggle bold for the next typed text, as Tiptap normally does. Reproduction on main: remap sidebar.toggle to alt+b, type x, press Ctrl+B (Cmd+B on macOS), type y. The result is <p>xy</p>, with no bold.

Change

This removes ComposerBoldSelectionOnlyExtension, the editor-level guard that swallowed Mod+B whenever the selection was empty, whatever the keybinding. The guard is only needed while Mod+B toggles the sidebar, and in that case the capture-phase listener in AppSidebarLayout already takes collapsed Mod+B (preventDefault + stopPropagation) before Tiptap sees it. It lets the chord through only when text is selected. With the guard gone, the keybinding layer alone decides:

  • Default binding: Mod+B with nothing selected still toggles the sidebar, and Mod+B over a selection still bolds.
  • Remapped binding: Mod+B is Tiptap's bold toggle again.

The isRichTextBoldShortcut comment is reworded to match.

Scope and approval

Fixes #29426

Triaged via the automated issue flow.

Verification

  • ComposerPromptEditorTiptap.input.browser.test.tsx › "bolds with Mod+B at a collapsed cursor and over a selection". This rewrites the old "only when text is selected" test, which mounted the editor alone and asserted the buggy behavior.
    • Collapsed Mod+B, then typing, gives bold text; Mod+B again turns it off.
    • Mod+B over a selection bolds it.
    • On main it fails with expected [] to deeply equal [' now']. With the fix it passes.
  • vp run check:changed: format, lint, knip, typecheck (2 packages), tests (4 files) and react compiler all pass.
  • Manual check in the real web client: vp run dev on a fresh database, Chromium on Linux (Mod = Ctrl), viewport 1280x800, light theme. Keys were sent as trusted key presses; the composer HTML was read from the editor.
Binding for sidebar.toggle Steps Before (main edc37c9) After (927f136)
alt+b (remapped) x, Ctrl+B, y, Ctrl+B, z <p>xyz</p>, no bold <p>x<strong>y</strong>z</p>, sidebar unchanged
mod+b (default) type, Ctrl+B at a collapsed cursor, type "plain ", Ctrl+B, "after": <p>plain after</p>, sidebar collapses "x", Ctrl+B, "y": <p>xy</p>, sidebar collapses (unchanged)
selection select the text, Ctrl+B with alt+b: "plain after" bolded with mod+b: "xy" bolded

Composer with sidebar.toggle on alt+b, after x, Ctrl+B, y, Ctrl+B, z. Same dev server and data on both sides; the before side served main's sources.

Before (edc37c9) After (927f136) Diff0 DiffT (fuzz 10%)
Before: composer shows xyz with no bold After: composer shows xyz with only y bold Diff at zero threshold Diff at 10 percent fuzz

Crop of the composer, before on top and after below

The diff is 180 px at threshold 0 and 129 px at 10% fuzz. Besides the bold y, it shows the text caret (visible only in the before frame, which caught a blink), the sidebar thread's relative time ("14m" before vs "10m" after, because the before frame was taken later), and a few anti-aliased pixels on the send button.

Not checked: macOS (Cmd) and the desktop shell. Both use the same key handling, and the desktop menu has no Mod+B accelerator.

Model and harness: Claude Opus 5.5 (lead, test, fix, review B) and GPT-6.1 Sol (review A), in T3 Code via the Claude Code and Codex harnesses.

🤖 Generated with Claude Code

Julius Marminge and others added 4 commits November 2, 2026 16:23
Rewrites the Mod+B composer test to expect standard Tiptap behaviour: with
a collapsed cursor and no app shortcut on Mod+B, the next typed text is
bold. Fails on main because ComposerBoldSelectionOnlyExtension swallows
collapsed Mod+B.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s remapped

The composer swallowed collapsed Mod+B so it would never bold by accident,
even when no app shortcut was bound to it. The sidebar's capture-phase
listener already keeps the chord for the toggle unless text is selected, so
drop the editor-side guard and let the keybinding layer decide.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Nov 2, 2026
@macroscopeapp

ghost commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 7e5d328

Macroscope's review found this PR approvable — Enables bold-at-cursor when the sidebar shortcut is remapped and adjusts formatting at Markdown marker boundaries. Default sidebar shortcut behavior remains unchanged, and the effects are limited to interactive composer formatting.

Notes:

  • All code in this push has already been reviewed. Approvability was decided on eligibility alone.

No code changes detected at da8b82a. Prior analysis still applies.

You can add or adjust custom eligibility rules. Learn more.

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Nov 2, 2026
@juliusmarminge juliusmarminge added bugfix Fix PR opened by an issue lead; enters the PR loop pr:needs-verification Reviewed and green; needs a run on a desktop, Android or iOS device and captures posted labels Nov 2, 2026
@coderabbitai

ghost commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The rich-text composer removes the extension that swallowed bold shortcuts at a collapsed cursor. Markdown-source shortcut handling checks whether a collapsed caret is at a style boundary. Browser tests cover collapsed-cursor formatting, formatting typed inside bold text, and bold formatting over a selection.

Changes: Composer style shortcuts

Layer / File(s) Summary
Update collapsed-cursor shortcut handling
apps/web/src/composer-rich-text-doc.ts, apps/web/src/components/ComposerPromptEditorTiptap.tsx, apps/web/src/composer-markdown-source.ts, apps/web/src/keybindings.ts, apps/web/src/components/ComposerPromptEditorTiptap.input.browser.test.tsx
The composer removes the extension that swallowed bold shortcuts for empty selections. Markdown-source shortcut handling detects a caret between a style marker and styled text; other empty-selection positions use Tiptap’s normal toggle behavior. The keybinding comment and browser tests reflect the shortcut behavior.

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

Change: Bug fix · Severity of issue fixed: Low

Possibly related issues

  • pingdotgg/t3code#34336 — This pull request fixes the Mod+B case when the sidebar binding is remapped; other formatting shortcut collisions are outside its scope.

Possibly related PRs

  • pingdotgg/t3code#24063 — This PR removes the extension introduced by #24063, which intercepted Mod+B for collapsed selections.
  • pingdotgg/t3code#34493 — Both PRs address configured app keybindings competing with rich-text formatting shortcuts.

Suggested reviewers: t3dotgg, shivamhwp

Merge Risk: Minimal · previous review 68caa

Mod+B now toggles bold at a collapsed cursor when the sidebar toggle is remapped, and the default sidebar behavior is reported as preserved. No merge-blocking risk was identified. macOS Cmd+B and the desktop shell were not manually checked, which is normal residual uncertainty.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title clearly and concisely identifies the main fix: Mod+B now toggles bold at a collapsed cursor when the sidebar binding is remapped.
Description check Passed The description includes complete Problem, Change, Scope and approval, and Verification sections. It explains expected behavior, implementation scope, linked issue, automated and manual verification, …
Linked Issues check Passed The changes meet the coding requirements in [#29426]. The PR removes ComposerBoldSelectionOnlyExtension, so Tiptap can toggle bold stored marks at a collapsed cursor. The browser tests cover collaps…
Out of Scope Changes check Passed The changes stay within [#29426]. The composer-markdown-source.ts update preserves Markdown-source handling while allowing normal Tiptap toggling at other collapsed cursors. The related shortcut tes…
Full details: Description check

Explanation

The description includes complete Problem, Change, Scope and approval, and Verification sections. It explains expected behavior, implementation scope, linked issue, automated and manual verification, screenshots, and unverified platforms.

Full details: Linked Issues check

Explanation

The changes meet the coding requirements in [#29426]. The PR removes ComposerBoldSelectionOnlyExtension, so Tiptap can toggle bold stored marks at a collapsed cursor. The browser tests cover collapsed-cursor bold toggling and bolding selected text. AppSidebarLayout still lets the configured sidebar binding claim collapsed Mod+B, while a remapped binding reaches Tiptap.

Full details: Out of Scope Changes check

Explanation

The changes stay within [#29426]. The composer-markdown-source.ts update preserves Markdown-source handling while allowing normal Tiptap toggling at other collapsed cursors. The related shortcut tests and comment update support the same rich-text keyboard behavior. No unrelated product change is shown.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between d1c9d05 and 68caab0.

Files selected for processing: 2

  • apps/web/src/components/ComposerPromptEditorTiptap.tsx
  • apps/web/src/composer-rich-text-doc.ts
Files with no reviewable changes: 2

  • apps/web/src/components/ComposerPromptEditorTiptap.tsx
  • apps/web/src/composer-rich-text-doc.ts

Limit details: You’ve used all 10 included reviews currently available.

Julius Marminge and others added 3 commits November 10, 2026 23:43
# Conflicts:
#	apps/web/src/components/ComposerPromptEditorTiptap.input.browser.test.tsx
#	apps/web/src/components/ComposerPromptEditorTiptap.tsx
…rkdown source

The Markdown-source shortcuts only handled a non-empty selection, so a
collapsed toggle inside shown markers fell through to Tiptap and typed text
landed inside the source (`**now **done****`). Parse the source first for
collapsed carets too, as the selection path already does.

AI-assisted; verified with the tests and tools listed above.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Only a collapsed caret next to shown markers goes through the source
toggle; elsewhere Tiptap's own toggle nests the style as before, instead
of the re-reveal dropping the stored mark.

AI-assisted; verified with the tests and tools listed above.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added size:M 30-99 changed lines (additions + deletions). and removed size:S 10-29 changed lines (additions + deletions). labels Nov 11, 2026
Only turning a style off just inside its own shown markers goes through the
source toggle. Adding a style at a marker boundary falls back to Tiptap's
toggle, as before, instead of the re-reveal dropping the stored mark.

AI-assisted; verified with the tests and tools listed above.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

ghost commented Nov 11, 2026

Copy link
Copy Markdown
Member Author

The automated pipeline stopped on this pull request and will not merge it:

someone else pushed to fix/issue-29426 (head is now 1ba5ee5); the pipeline does not build on commits it did not review

It stays open for a person to finish or close.

@macroscopeapp
macroscopeapp Bot dismissed their stale review November 11, 2026 02:13

Dismissing prior approval to re-evaluate 238091e

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Nov 11, 2026
Julius Marminge and others added 2 commits November 11, 2026 03:16
AI-assisted; verified with the tests and tools listed above.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@macroscopeapp
macroscopeapp Bot dismissed their stale review November 11, 2026 06:05

Dismissing prior approval to re-evaluate 7e5d328

@github-actions

ghost commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Thread transfer impact

⚠️ The latest CI run did not produce a thread transfer result for 7e5d328.

This comment will update automatically after the next completed run.

@juliusmarminge

ghost commented Nov 11, 2026

Copy link
Copy Markdown
Member Author

Evidence

Linux Chromium, 1280×800, light theme, fresh synthetic data on both commits. With Rich text composer enabled, remap sidebar.toggle to Alt+B, then type x, Ctrl+B, y, Ctrl+B, z. Base leaves everything plain; head bolds only y, with the sidebar unchanged. Restore Ctrl+B and repeat: the sidebar toggles and typing stays plain. Selecting text and pressing Ctrl+B bolds it with either binding on both commits.

Before After
25631c3c83 d1c9d05f0c
Before: composer detail, xyz plain After: composer detail, only y bold
Before: full app, sidebar open After: full app, sidebar open
Before recording After recording

Recordings show the same scripted interactions at half speed. Detail images are enlarged crops of the full captures. Scenario/driver.

AI-assisted; verified with the tests and tools listed above.

Not shown:

  • macOS Cmd+B and Windows were not exercised; this proof used Linux Chromium Ctrl+B.
  • Additional italic/code-mark boundary behavior changed by the PR was outside this Mod+B reproduction.

@juliusmarminge

ghost commented Nov 12, 2026

Copy link
Copy Markdown
Member Author

Evidence

Environment for every capture: Linux Chromium 156, real web dev app, 1280×800, light theme, fresh isolated synthetic project, replay provider.

Enable Rich text composer. Remap Sidebar: Toggle to Alt+B. In an empty composer type x, Ctrl+B, y, Ctrl+B, z. Select all and Ctrl+B. Clear formatting and the draft, restore the default Ctrl+B sidebar binding, repeat the typing sequence, then select all and Ctrl+B.

Proven: scenarios:prove exited 0. Base left xyz plain; head bolded only y and left the sidebar open. With the default binding, Ctrl+B toggled the sidebar and typing stayed plain. Selection bolding worked with either binding on both commits.

Evidence Before After
Commit 04be2b365f da8b82a353
Remapped collapsed cursor Before: xyz plain After: only y bold
Composer detail, 2× crop Before detail After detail
Remapped selection Before selection bold After selection bold
Default sidebar shortcut Before sidebar collapsed After sidebar collapsed
Default typing Before xyz plain After xyz plain
Default selection Before selection bold After selection bold
Recording Before recording After recording

Scenario driver

AI-assisted; verified with the tests and tools listed above.

Not shown:

  • macOS Cmd+B and Windows were not exercised; this comparison ran Linux Chromium with Ctrl+B.
  • Italic/code shortcuts and cursor positions beside existing Markdown markers were not exercised; the scenario targets the reported bold/sidebar reproduction.

@juliusmarminge
juliusmarminge merged commit 2904fea into main Nov 12, 2026
@juliusmarminge
juliusmarminge deleted the fix/issue-29426 branch November 12, 2026 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Fix PR opened by an issue lead; enters the PR loop pr:needs-verification Reviewed and green; needs a run on a desktop, Android or iOS device and captures posted size:M 30-99 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Remapping sidebar.toggle away from Mod+B still blocks Mod+B bold toggle in rich-text composer

1 participant