Repository navigation
fix(ui): pinpoint in a question card targets what was clicked, not the prompt - #1683
Merged
Merged
Conversation
…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>
1 task
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.
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 readslist 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-noneelement as a list item, and makesblock.children[1]the block's target (listContentElement). A:::questioncard's first child is itsselect-noneeyebrow ("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.tsxchecked 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
question: "…"). Its prompt, its context and each choice's text are child targets.QuestionBlockmarks them with an additivedata-question-partattribute (prompt/context/choice).listContentElementno longer treats a question card as a list item.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 typecheckpasses,bun testpasses (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)
P, and a click answers nothing.1/8). Clicking the prompt still pins the prompt.