Keep slides text-box in edit mode when clicking toolbar controls#301
Conversation
The slides text box reuses the docs initializeTextBox, which commits and detaches on any textarea blur. Clicking a formatting toolbar control stole focus on mousedown, so the commit+detach ran BEFORE the control's onClick — the action (e.g. the bullet-list toggle) never applied and edit mode collapsed entirely. Direct buttons/toggles now preventDefault their mousedown so the textarea never blurs. Dropdowns can't rely on that (Radix focuses menu items on pointer hover), so the docs text-box blur handler skips the commit when focus moves into a [data-text-edit-keepalive] element; dropdown triggers and content carry that marker, and content prevents close-auto-focus so the box stays focused after a selection. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
Warning Review limit reached
Your plan includes 1 review of capacity. Refill in 32 minutes and 29 seconds. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more review capacity refills, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (9)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Verification: verify:selfResult: ✅ PASS in 230.8s
Verification: verify:integrationResult: ✅ PASS |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
PRs #257/#301/#303/#304/#305/#306/#307/#309/#315/#316/#317/#321/#322 shipped between v0.4.2 and the v0.4.3 cut, leaving their paired todo files in active with the process checkboxes still open. Flip the remaining boxes for the work that landed, then move the paired todo/lessons into docs/tasks/archive/2026/05/ via pnpm tasks:archive. Active count drops from 17 to 6; archive count grows by 21 files. Patch release covering 29 commits since v0.4.2. Headline theme is Slides editing & UX polish toward Google Slides / PowerPoint parity: smart guides (equal-spacing / distance / size), Shift drag modifiers, text inside shapes, a Format options right panel, tier-1 universal toolbar controls, text autofit (shrink + grow), group-selection visuals, and several smaller text-box / selection fixes. PPTX import gained paragraph-level bullet styles, body anchor (vertical alignment), and stretched blipFill cover-crop. Docs added a pending-inline-style at collapsed caret, a caret that tracks the resolved text color, bullet indent on Tab / Shift+Tab, font / size / line-spacing / clear formatting toolbar controls, an inline-style-attribute clear that actually lands in the CRDT, and a polished toolbar trigger / color swatch pass shared across docs / sheets / slides. Sheets gained .xlsx import. Infrastructure: Docker images now build on native arm64 runners, fixing the release hang seen on v0.4.2. No Prisma migration, no new backend env vars — the devops bump is a routine image-tag change. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Summary
In the Slides text-box edit mode, clicking a formatting toolbar control (reported: the bullet-list icon) did not apply the action and instead dropped the user out of text editing entirely.
Root cause: the slides text box reuses the docs
initializeTextBox, whose hidden<textarea>commits + detaches on any blur. Clicking a toolbar control steals focus onmousedown, so the commit+detach (onCommit→finishEditMode()) runs before the control's ReactonClick— the toggle is applied to an already-detached editor and edit mode collapses. Docs is immune because its main editor is always mounted.Two distinct trigger classes, fixed with the canonical mechanism for each:
onMouseDownpreventDefault()so the textarea never blurs (no commit/detach, focus retained for continued typing).preventDefaultcan't help because Radix focuses menu items on pointer hover (@radix-ui/react-menuMenuItemImpl.onPointerMove). Instead the docs text-boxhandleBlurskips the commit whenrelatedTargetis inside adata-text-edit-keepaliveelement; dropdown triggers + content carry that marker, and content prevents close-auto-focus so the box stays focused after a selection.Scope:
initializeTextBoxis slides-only (the docs main editor usestext-editor.ts), so thehandleBlurchange does not affect the docs editor. Thedata-text-edit-keepaliveattributes /onCloseAutoFocusare inert (and mildly beneficial) in the docs toolbar.Test plan
pnpm verify:fast— green (EXIT=0).packages/docs/test/view/text-box-editor.test.ts(editor-side guard): blur into a[data-text-edit-keepalive]control (button + menu-item descendant) does not commit; a genuine outside blur still commits.packages/frontend/tests/components/text-formatting/toolbar-focus.test.ts(React layer): renders the three shared groups in jsdom; asserts the 9 direct buttons/togglespreventDefaultmousedown, that the bullet click still callstoggleList('unordered'), and that the 3 dropdown triggers carrydata-text-edit-keepalive.pnpm dev): entered a slides text box → bullet/numbered/indent/bold/link all apply and stay in edit mode; style/alignment/text-color/highlight dropdowns apply and keep editing.🤖 Generated with Claude Code