Skip to content

callouts: let readers select the text of a bubble - #11

Merged
ewels merged 2 commits into
mainfrom
callouts-selectable-text
Oct 5, 2026
Merged

ewels merged 2 commits into
mainfrom
callouts-selectable-text

Conversation

@ewels

@ewels ewels commented Oct 5, 2026

Copy link
Copy Markdown
Owner

Closes #10

Readers can now select and copy the text of an inline callout bubble. A selection that starts in the code still leaves every bubble out, so the paste never has prose in the middle of the code.

This takes a different route from the proposal in the issue. A new client module (client/callouts.ts, loaded only on blocks with data-scb-callouts) listens for pointerdown on the document. A pointerdown in a bubble turns on user-select: text for that bubble until the next pointerdown. The wrapper, its padding and the arrow keep user-select: none. The proposed copy handler would let a drag across the code highlight the bubble but then leave its text out of the paste, so the paste would differ from what the reader sees selected. DECISIONS.md already rejects a copy handler for hidden lines for that reason. With this approach, what is highlighted is what gets copied, and no clipboard text has to be rebuilt. If you prefer the copy handler, say so and I will switch to it.

Other changes:

  • The placeholders copy handler now lets through a selection that is wholly inside a callout. Before, it would have copied an empty string, because it leaves out everything under a user-select: none ancestor.
  • Docs: the inline callouts page says that a selection must start in the bubble, and that bubble text cannot be selected without JavaScript.
  • DECISIONS.md records the choice and the options that were rejected.
  • Tests: a Vitest check that the block gets data-scb-callouts only when it has a callout, and a Playwright test on the callouts page. The test drags inside a bubble and checks the selection and the clipboard, then drags from the first code line to the second, across the bubble, and checks that the bubble text is not in the selection or the clipboard.

pnpm lint, pnpm test, pnpm docs:build, pnpm lint:docs and the full Playwright suite pass (733 passed, 302 skipped).

🤖 Generated with Claude Code

ewels and others added 2 commits October 5, 2026 12:52
…bble

A pointerdown in a bubble turns on user-select: text for that bubble, so a
drag across the code still leaves callouts out of the selection and the copy.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@ewels
ewels merged commit 87bc4fd into main Oct 5, 2026
3 checks passed
@ewels
ewels deleted the callouts-selectable-text branch October 5, 2026 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Callouts: bubble text can't be selected

1 participant