Skip to content

fix(ui): pinpoint in a question card targets what was clicked, not the prompt - #1683

Merged
backnotprop merged 2 commits into
mainfrom
fix/question-card-pinpoint-target
Oct 4, 2026
Merged

backnotprop merged 2 commits into
mainfrom
fix/question-card-pinpoint-target

Conversation

@backnotprop

Copy link
Copy Markdown
Owner

Bug

Owner report: clicking the first option of a question card highlights the question's prompt instead.

Reproduced in headless Chromium against a CLI built from main (annotate QUESTIONS.md --gate --json, temp data dir). It happens only in Pinpoint input mode. Select, Markup, Comment, Redline and Label all behave correctly. In Pinpoint mode, hovering any choice outlines the prompt <p> (the hover label reads list item: "Should issues be numb…"). Clicking a choice pins the prompt and does not record an answer (0/8 answered).

Root cause

buildSemanticTargetGraph (packages/ui/utils/blockTargeting.ts) treats any block that contains a .select-none element as a list item, and makes block.children[1] the block's target (listContentElement). A :::question card's first child is its select-none eyebrow ("QUESTION 1 OF 8"), so its second child, the prompt, became the target for the whole card. Every pinpoint hover or click inside the card resolved to the prompt.

The existing test usePinpoint.question.test.tsx checked that one pin happened, but not what was pinned, so the wrong target got through. The bug has been present since question cards shipped (#1637, v0.27.23).

Fix

  • The card is now one block target (the fieldset, labelled question: "…"). Its prompt, its context and each choice's text are child targets. QuestionBlock marks them with an additive data-question-part attribute (prompt / context / choice).
  • The pointer resolves to the part under it. A choice row's padding and marker belong to that choice.
  • listContentElement no longer treats a question card as a list item.
  • Behavior that does not change: a pinpoint click on a choice's text pins that text (feat(editor): question answers — history, progress chip, Questions panel, Send answers (PR 2) #1638 designed it this way). A click on the radio/checkbox answers. Non-pinpoint modes are unaffected. Vim's child motion now steps into the card's parts.

Tests

  • usePinpoint.question.test.tsx (already in the CI DOM list) now asserts the pinned text. New cases: the first choice pins itself and not the prompt; the prompt and the context each pin themselves. Without the fix, 3 of the 4 cases fail.
  • bun run typecheck passes, bun test passes (5938 pass, 0 fail), and the DOM suites for vim and questions pass.

Live verification (built CLI, owner's document copied to a temp dir)

  • Pinpoint, before the fix: hovering choice 1 outlines the prompt P, and a click answers nothing.
  • Pinpoint, after the fix: hovering choice 1 outlines the choice text. A click pins "One list per monorepo, with an optional project field" (toolbar opens next to it). The prompt is untouched. Clicking the radio records the answer (1/8). Clicking the prompt still pins the prompt.
  • Default (Select) mode: clicking the option answers. Drag-selecting words in the prompt still creates a normal text annotation.

backnotprop and others added 2 commits October 4, 2026 06:38
…t the prompt

The semantic target graph treats any block containing a `.select-none`
element as a list item and uses its second child as the block's target.
A `:::question` card starts with a select-none eyebrow, so its second
child, the prompt, became the target for the whole card: in Pinpoint
mode, hovering or clicking a choice (or the context) outlined and pinned
the prompt instead.

The card is now one block target (the fieldset) whose prompt, context
and each choice's text are child targets, marked with
`data-question-part`. A click on a choice row pins that choice's text;
a click on the radio still answers. The regression test now asserts
WHAT is pinned, which is the gap that let this through since the
question cards shipped (v0.27.23).
…, alert and question blocks

Renders real BlockRenderer output and asserts that a list item and a task
item still target their text (the select-none marker heuristic), that a
callout and an alert target the whole block, and that a question card is
one block whose parts pointer hit-testing and Vim (into, across, out, past)
reach. The question case fails against main.

Co-Authored-By: Claude <noreply@anthropic.com>
@backnotprop
backnotprop merged commit 53d5c50 into main Oct 4, 2026
28 checks passed
@backnotprop
backnotprop deleted the fix/question-card-pinpoint-target branch October 4, 2026 14:13
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