Repository navigation
Conversation
The controller tests asserted "now shown" 50 ms after the 250 ms show delay (30 ms after the 60 ms reposition debounce). In Bun's shared test process a late timer made them flaky; they now poll with a 1 s ceiling.
A range starting on a block boundary (select all from 0, or a band hit between blocks) holds that whole block, so getClientRects returned its border box as the first line. intoTextblock moves both ends into a textblock first; coordsAtPos reads those positions too. Under the last selected line the bubble left the view when the selection runs past the band's bottom, or when there is no room for it there: the bottom side then anchors under the first line that shows.
Mod-A makes an AllSelection, which shouldShowBubble rejected as not a TextSelection. Spec 7.2 has the bubble show for select all, anchored to the first selected line that is visible.
Moves listenerCounts out of editor-leak.spec.ts into a helper, so the selection bubble's tab-switch test can count the same listeners.
SelectionBubbleView no longer renders Tiptap's BubbleMenu, which called registerPlugin from the lazy bubble chunk and rebuilt every plugin view when it landed. A BubbleController per editor shows, hides and positions one reused root through a portal; the DOM contract is unchanged (appended to the scroll container on show, removed on hide). The BUBBLE_KEY meta, the requestAnimationFrame re-append workaround and the opacity focus-out guard go. Placement changes reposition only when the side changes, and a selection made before the chunk landed shows at once. New e2e cases: no plugin is registered on mount, the anchor on a wrapped second line and on select all, whitespace-only selections, dragstart, a tab switch with the bubble open, and a collaborator deleting the selection.
Adds amendment A18 to the smart toolbar v1 contract and the Unreleased CHANGELOG entry, with the measured editor and bubble chunk sizes.
A start at a textblock's end (a drag begun past the line end, or a band hit in the gap after a paragraph) kept the measured range open over the next blocks, and getClientRects returned their whole border boxes, so the first line became a whole block. The scan now reads one textblock per range, skipping ends and empty textblocks, within the 300-position budget; the bottom side mirrors it. The kept-timer unit test now checks the bubble shows before a full show delay after the no-op transaction.
The wrapped-line case now selects across the wrap and compares the centre with the top line's part only. A selection starting at a paragraph's end must anchor to the next line's text, and select all is also checked with multi-line paragraphs, the band edge in a gap and inside one.
…edges Focus coming back to the editor (Esc on a bubble item) re-evaluated at once and hid the suppressed bubble 5 ms in, cutting its 90 ms exit fade. The plugin debounced that path; focus now re-evaluates only while the bubble is hidden, and compositionend stays immediate. hide() resets the root's visibility, so a re-shown root waits for its first position instead of showing at the old one. The band-edge probe reads both inline edges and keeps the smaller position, so a right-to-left line is read from its start.
Esc on a bubble item must leave data-closing for the fade before the root goes. The collaborator case now deletes the selection while a bubble item has focus, expects the editor focused afterwards, and a new selection to show the bubble again (no suppression left behind).
The anchor change is horizontal centring on the selected part of the first line and no whole-block anchoring, not a fix for covering the line above. Re-measured after the review fixes: editor chunk group 393,171 B gz (-1 B against main), bubble chunk 9,798 B gz (-2,440 B).
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This is phase P0 of the approved bubble and quick insert design (spec §12.1, BQ2 and BQ3).
The desktop selection bubble no longer mounts Tiptap's React
<BubbleMenu>. That component callseditor.registerPluginfrom the lazy bubble chunk, which rebuilt all 29 plugin views after the editor was already interactive.A framework-free
BubbleController, in the same lazy chunk, now:@floating-ui/dom;data-smart-bubble,data-stateand onerole="toolbar".Depends on #124 (the spec and plan this PR cites). Merge #124 first.
What changes for writers
Sizes
Production build,
scripts/check-editor-chunk-size.ts:@tiptap/extension-bubble-menuis no longer importedScreenshots
A two-line selection:
mainon the left, this branch on the right.Test plan
bubble-controller.test.tsandselection-bubble-rules.test.ts(100 pass). They cover the 250 ms show delay, the IME composition skip,dragstartandcontextmenu, drag-then-pointerup, blur rules,setEditable, idempotentdestroy, the RTL band-edge probe, and the textblock-bounded anchor.dragstart;bun run test(1730 pass),typecheck,lintandcheck(only the 7 existing warnings).Notes
docs/superpowers/specs/2026-11-13-smart-toolbar-v1-contract.md.shouldShowBubblereads the whole document's text on remote changes while select all is active.🤖 Generated with Claude Code