Skip to content

A selected chip at the start of a line keeps its whole ring in a comment field - #168

Merged
danipen merged 1 commit into
mainfrom
fix/selected-chip-ring
Oct 29, 2026
Merged

danipen merged 1 commit into
mainfrom
fix/selected-chip-ring

Conversation

@danipen

@danipen danipen commented Oct 29, 2026

Copy link
Copy Markdown
Member

What does this pull request do?

A selected chip, bullet, image or table at the start of a line in a comment field now shows its whole selection ring.

Current behavior

When a selection covered a chip at the start of a line, the left edge of its ring was cut off by a pixel or two. This happened in the small field and in the larger editor alike.

Behavior with this pull request

The ring shows whole on every side, wherever the widget sits on its line.

Selected task, bullet, image and table in the larger editor, each ring whole at the line start

How it was implemented

  • The cause: a widget the selection covers (selectionCovers, .cm-selectedWidget; a table's data-selected) drew its ring as an outer box-shadow: 0 0 0 1px. That ring sits outside the widget's box, so at the start of a line it fell past the edge of CodeMirror's .cm-scroller (overflow: hidden auto), which cut it off.
  • The fix: the ring is now an outline drawn inside the box (outline: 1px solid var(--accent); outline-offset: -1px), the idiom SuggestionList.module.css already uses. An outline paints above the widget's own content.
  • Alternatives dropped:
    • padding the scroller would shift every comment's text;
    • an inset box-shadow paints under the chip's content and doesn't draw on a native checkbox.

Behavior changes

  • The ring now covers the widget's outer pixel instead of sitting around it.
  • A selected task checkbox shows the ring on its own edge, as an accent-edged box. That is still distinct from a checked box, which is filled.
  • A selected table's ring sits on its left cell border.

Checklist

  • npm run typecheck and npm test pass (8,489). No new unit test: this is CSS geometry with no decision in it, which vitest can't see, so it was checked on screen.
  • Seen in a development build on a sandbox, with select-all over a comment holding a task, a bullet, an image, a table and reference chips:
    • inline and in the larger editor;
    • in both themes;
    • with a clean console.
  • npm run e2e: not run (a style rule in the comment editor only).
  • Other areas: only the comment editor's covered widgets use this rule (liveDecorations.ts, EditorTable.tsx).
  • Reviewed in a clean context: no code changes asked. It asked to see the checkbox, bullet, image and table, not only the chip, which is the check above.
  • docs/: no change. rich-comments.md says covered widgets show as selected, not how the ring is drawn.

Fixed issues

None

🤖 Generated with Claude Code

…ent field

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@danipen
danipen added this pull request to the merge queue Oct 29, 2026
Merged via the queue into main with commit e1174cc Oct 29, 2026
9 checks passed
@danipen
danipen deleted the fix/selected-chip-ring branch October 29, 2026 17:03
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.

1 participant