Repository navigation
feat(web): progress pill, inline description, commit animation, new-eyebrow fix - #58
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
…yebrow fix QA round covering four question-flow issues (#4, #5, #6, #7): **#4 Progress pill + nav hover** - Wraps the top-right "Progress" link in a bordered pill so it reads as a target, not body text. - Unifies Back / Skip hover to accent (previously faded-to-muted, almost invisible) — all three clickable cues in the card now signal the same way. **#5 Inline description with reserved slot** - Replaces the "What's this?" toggle with an always-rendered description rendered as a muted paragraph with a 2px accent-light left rule (editorial-aside style). `text-pretty` handles orphan avoidance. - Reserves 2.75rem below the heading so cards stay a uniform height whether or not the question has a description (~43% do). Removes the showDescription state from Question.tsx and the toggle logic it carried. **#6 Suppress "New category" eyebrow when returning** - The welcome-interstitial eyebrow hid "New category" once the user has answers in that category — no longer reads as "new" on resume. - Threaded via a `hasAnswersInCategory` boolean computed on demand in Question.tsx (cheap per-render lookup). **#7 α commit animation + keyboard listener refactor** - 300ms spring-pop keyframe `commit-alpha` overshoots and settles into the existing selected-answer ring, giving keyboard commits visual feedback before the advance fires. - Moves number-key handling out of Question.tsx's window listener into two new scoped components — `RatingGroup` (1-5) and `TimingButtons` (1/n, 2/l) — each owning its own `useState<Rating|null>` + `onAnimationEnd`-driven commit flow. Listener lifetimes match each component's mount, so the two never compete. - Mouse clicks stay instant (detect via `event.detail === 0`). Reduced- motion users get a 1ms keyframe so the commit still dispatches but no visible motion plays. - Page-level arrows (prev/next question) stay in Question.tsx. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
5ce816e to
2c627af
Compare
…lStore Surfaced while wiring pr-c-answering-flow's welcome-screen CTA logic. Discovered along the way that existing Summary.tsx + Review.tsx useMemo blocks depend on `answers` which has fresh object identity per render — the memos never cache. Promoting from "nice to have" to p2 because it's actively defeating existing memoization. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…ns-by-id map Two more wins surfaced alongside the useSyncExternalStore item — lump under the same p2 entry since they're all "do one pass on render-time computes" work that makes sense batched. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Replaces the 2px accent-light left rule + indent with italic muted text. The aside-rule felt heavier than the description warranted — italic carries the "secondary voice" cue with less chrome and stays closer to the question's typographic line. No visual baseline change captured because the e2e admin flow narrows to "Group & External" whose first question has no description. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Clicking a half-filled category from Summary used to land on the welcome screen and the only Start button took you to the *first* question of the category — re-walking already-answered ones instead of resuming where you left off. Three states now, mirroring the /group screen vocabulary: fresh (no answers) → [Start] partial (some answered) → [Continue] + [Review from the start] complete (all answered) → [Review from the start] Continue jumps to the first unanswered question in the category. Review from the start jumps to the first question (regardless of answer state) so the user can walk through edits. No visual baseline change — e2e admin flow only exercises the fresh state on the welcome screen. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
QA flagged that the rating glossary disappears after the intro screen — Andrey forgot what "Fantasy only" meant mid-flow. Adds a small HelpCircle icon next to the Progress chip in the question card header. Click toggles a popover showing all rating options (Yes / If partner wants / Maybe / Fantasy only / No) with their one-line meanings, sourced verbatim from `UI.intro.answers` so it matches the intro copy. Switches content based on context: when the timing sub-question is showing (Now / Later), the popover swaps to the timing glossary (`UI.intro.timing`) instead. Closes on Escape, click-outside, or the in-popover × button. Auto-closes when the answer mode flips. Tests: e2e asserts both the rating-mode glossary opens and that it swaps to the timing glossary after committing Yes; visual snapshot of the open popover is captured alongside the description regression shot — both desktop and mobile baselines. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/web/src/screens/Question.tsx`:
- Around line 164-179: The page-level ArrowLeft/ArrowRight handler in the
useEffect (handleKeyDown in Question.tsx) must ignore events already handled by
child components like RatingGroup in QuestionCard.tsx; modify handleKeyDown to
immediately return when e.defaultPrevented is true (or when event.target is
inside an input/control as needed) so that roving radio focus consumes the arrow
keys first and the window listener does not also navigate between screens.
In `@packages/web/src/screens/QuestionCard.tsx`:
- Around line 81-101: The outside-dismiss effect uses a MouseEvent listener
named onPointerDown and listens for "mousedown", which misses touch/pen input;
update onPointerDown to accept a PointerEvent (change its parameter type from
MouseEvent to PointerEvent), and change the event listener calls to use
"pointerdown" instead of "mousedown" in the useEffect; keep the same guard logic
referencing helpPopoverRef and helpButtonRef and ensure you update both
addEventListener and removeEventListener calls so the listener is properly
cleaned up.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 7e50e3a0-2764-4b42-bda2-fed69eb97578
⛔ Files ignored due to path filters (8)
e2e/visual/admin-flow.spec.ts-snapshots/question-timing-visual-desktop-linux.pngis excluded by!**/*.pnge2e/visual/admin-flow.spec.ts-snapshots/question-timing-visual-mobile-linux.pngis excluded by!**/*.pnge2e/visual/admin-flow.spec.ts-snapshots/question-unanswered-visual-desktop-linux.pngis excluded by!**/*.pnge2e/visual/admin-flow.spec.ts-snapshots/question-unanswered-visual-mobile-linux.pngis excluded by!**/*.pnge2e/visual/admin-flow.spec.ts-snapshots/question-with-description-visual-desktop-linux.pngis excluded by!**/*.pnge2e/visual/admin-flow.spec.ts-snapshots/question-with-description-visual-mobile-linux.pngis excluded by!**/*.pnge2e/visual/admin-flow.spec.ts-snapshots/question-with-help-popover-visual-desktop-linux.pngis excluded by!**/*.pnge2e/visual/admin-flow.spec.ts-snapshots/question-with-help-popover-visual-mobile-linux.pngis excluded by!**/*.png
📒 Files selected for processing (7)
e2e/fill-questionnaire.spec.tse2e/visual/admin-flow.spec.tspackages/web/src/index.csspackages/web/src/screens/CategoryWelcomeScreen.tsxpackages/web/src/screens/Question.tsxpackages/web/src/screens/QuestionCard.tsxtodo.md
| // Page-level keyboard navigation — Arrow left/right only. Rating number | ||
| // keys (1-5) and timing keys (1/n, 2/l) are owned by the RatingGroup and | ||
| // TimingButtons components in QuestionCard, scoped to their mount. | ||
| useEffect(() => { | ||
| function handleKeyDown(e: KeyboardEvent) { | ||
| if (e.key === "ArrowLeft") { | ||
| setIndex((i) => Math.max(0, i - 1)); | ||
| setShowTiming(false); | ||
| setShowDescription(false); | ||
| } else if (e.key === "ArrowRight") { | ||
| setIndex((i) => Math.min(screens.length, i + 1)); | ||
| setShowTiming(false); | ||
| setShowDescription(false); | ||
| } else if (showTiming && (e.key === "1" || e.key === "n")) { | ||
| handleTimingRef.current?.("now"); | ||
| } else if (showTiming && (e.key === "2" || e.key === "l")) { | ||
| handleTimingRef.current?.("later"); | ||
| } else if (!showTiming && keyRatingMap[e.key]) { | ||
| handleRatingRef.current?.(keyRatingMap[e.key]); | ||
| } | ||
| } | ||
| window.addEventListener("keydown", handleKeyDown); | ||
| return () => window.removeEventListener("keydown", handleKeyDown); | ||
| }, [screens.length, showTiming]); | ||
| }, [screens.length]); |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# First, locate and examine the Question.tsx file
fd -t f "Question.tsx" packages/web/src/
# Check the exact lines mentioned (164-179)
sed -n '164,179p' packages/web/src/screens/Question.tsxRepository: iskhakovt/spreadsheet
Length of output: 795
🏁 Script executed:
# Also check the QuestionCard.tsx to see the RatingGroup implementation
fd -t f "QuestionCard.tsx" packages/web/src/
# Look at lines 275-288 mentioned in the comment
sed -n '275,288p' packages/web/src/screens/QuestionCard.tsxRepository: iskhakovt/spreadsheet
Length of output: 593
🏁 Script executed:
# Search for RatingGroup component definition and its handleArrowKeyDown method
rg -A 15 "handleArrowKeyDown" packages/web/src/screens/QuestionCard.tsxRepository: iskhakovt/spreadsheet
Length of output: 1292
🏁 Script executed:
# Check if preventDefault is actually called in the RatingGroup or its parent
rg "preventDefault" packages/web/src/screens/QuestionCard.tsx -B 2 -A 2Repository: iskhakovt/spreadsheet
Length of output: 846
Honor handled arrow keys before page-level navigation.
RatingGroup already consumes ArrowLeft/ArrowRight for roving radio focus in packages/web/src/screens/QuestionCard.tsx, but this window listener still runs because it ignores e.defaultPrevented. Pressing an arrow key on a focused rating button will move focus and navigate away from the question.
Suggested fix
useEffect(() => {
function handleKeyDown(e: KeyboardEvent) {
+ if (e.defaultPrevented) return;
if (e.key === "ArrowLeft") {
setIndex((i) => Math.max(0, i - 1));
setShowTiming(false);
} else if (e.key === "ArrowRight") {
setIndex((i) => Math.min(screens.length, i + 1));
setShowTiming(false);
}
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // Page-level keyboard navigation — Arrow left/right only. Rating number | |
| // keys (1-5) and timing keys (1/n, 2/l) are owned by the RatingGroup and | |
| // TimingButtons components in QuestionCard, scoped to their mount. | |
| useEffect(() => { | |
| function handleKeyDown(e: KeyboardEvent) { | |
| if (e.key === "ArrowLeft") { | |
| setIndex((i) => Math.max(0, i - 1)); | |
| setShowTiming(false); | |
| setShowDescription(false); | |
| } else if (e.key === "ArrowRight") { | |
| setIndex((i) => Math.min(screens.length, i + 1)); | |
| setShowTiming(false); | |
| setShowDescription(false); | |
| } else if (showTiming && (e.key === "1" || e.key === "n")) { | |
| handleTimingRef.current?.("now"); | |
| } else if (showTiming && (e.key === "2" || e.key === "l")) { | |
| handleTimingRef.current?.("later"); | |
| } else if (!showTiming && keyRatingMap[e.key]) { | |
| handleRatingRef.current?.(keyRatingMap[e.key]); | |
| } | |
| } | |
| window.addEventListener("keydown", handleKeyDown); | |
| return () => window.removeEventListener("keydown", handleKeyDown); | |
| }, [screens.length, showTiming]); | |
| }, [screens.length]); | |
| // Page-level keyboard navigation — Arrow left/right only. Rating number | |
| // keys (1-5) and timing keys (1/n, 2/l) are owned by the RatingGroup and | |
| // TimingButtons components in QuestionCard, scoped to their mount. | |
| useEffect(() => { | |
| function handleKeyDown(e: KeyboardEvent) { | |
| if (e.defaultPrevented) return; | |
| if (e.key === "ArrowLeft") { | |
| setIndex((i) => Math.max(0, i - 1)); | |
| setShowTiming(false); | |
| } else if (e.key === "ArrowRight") { | |
| setIndex((i) => Math.min(screens.length, i + 1)); | |
| setShowTiming(false); | |
| } | |
| } | |
| window.addEventListener("keydown", handleKeyDown); | |
| return () => window.removeEventListener("keydown", handleKeyDown); | |
| }, [screens.length]); |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/web/src/screens/Question.tsx` around lines 164 - 179, The page-level
ArrowLeft/ArrowRight handler in the useEffect (handleKeyDown in Question.tsx)
must ignore events already handled by child components like RatingGroup in
QuestionCard.tsx; modify handleKeyDown to immediately return when
e.defaultPrevented is true (or when event.target is inside an input/control as
needed) so that roving radio focus consumes the arrow keys first and the window
listener does not also navigate between screens.
| // Click-outside + Escape close the help popover. Window-level so the user | ||
| // can dismiss from anywhere on the page; the listener tears down with the | ||
| // component (and is a no-op while closed). | ||
| useEffect(() => { | ||
| if (!helpOpen) return; | ||
| function onKeyDown(e: KeyboardEvent) { | ||
| if (e.key === "Escape") setHelpOpen(false); | ||
| } | ||
| function onPointerDown(e: MouseEvent) { | ||
| const target = e.target as Node; | ||
| if (helpPopoverRef.current?.contains(target)) return; | ||
| if (helpButtonRef.current?.contains(target)) return; | ||
| setHelpOpen(false); | ||
| } | ||
| window.addEventListener("keydown", onKeyDown); | ||
| window.addEventListener("mousedown", onPointerDown); | ||
| return () => { | ||
| window.removeEventListener("keydown", onKeyDown); | ||
| window.removeEventListener("mousedown", onPointerDown); | ||
| }; | ||
| }, [helpOpen]); |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# First, let's check if the file exists and examine lines 81-101
cat -n packages/web/src/screens/QuestionCard.tsx | sed -n '75,110p'Repository: iskhakovt/spreadsheet
Length of output: 1742
🏁 Script executed:
# Also check the full file structure to understand context
wc -l packages/web/src/screens/QuestionCard.tsxRepository: iskhakovt/spreadsheet
Length of output: 110
🏁 Script executed:
# Search for other event listener patterns in the codebase to understand conventions
rg 'addEventListener.*pointer|addEventListener.*mouse' packages/web/src --type ts --type tsx -A 2Repository: iskhakovt/spreadsheet
Length of output: 92
🏁 Script executed:
# Check if there's any touch event handling elsewhere
rg 'pointerdown|touchstart' packages/web/src --type ts --type tsxRepository: iskhakovt/spreadsheet
Length of output: 92
🏁 Script executed:
# Search for event listeners without type flag
rg 'addEventListener.*pointer|addEventListener.*mouse|addEventListener.*touch' packages/web/src -A 2Repository: iskhakovt/spreadsheet
Length of output: 322
🏁 Script executed:
# Check if any touch handlers exist in the file itself
rg 'touch|pointer|mouse' packages/web/src/screens/QuestionCard.tsx -iRepository: iskhakovt/spreadsheet
Length of output: 645
🏁 Script executed:
# Check common event handling patterns in components
rg '(pointerdown|pointerup|pointermove|touchstart)' packages/web/src --max-count 20Repository: iskhakovt/spreadsheet
Length of output: 47
🌐 Web query:
pointerdown vs mousedown touch events best practice 2024
💡 Result:
For handling pointerdown vs mousedown events with touch support, the best practice in 2024-2026 is to use Pointer Events (pointerdown) exclusively instead of mousedown or touchstart. Pointer Events provide a unified, hardware-agnostic API that works seamlessly across mouse, touch, pen/stylus inputs with a single set of handlers, simplifying code and reducing bugs from device-specific logic. Key differences: - mousedown fires on every mouse button press; pointerdown fires only on the first button press (mouse) or contact (touch/pen). - On touchscreens, browsers implicitly capture the pointer on pointerdown, routing subsequent events (move/out/over) to the target element until pointerup/cancel. Use setPointerCapture(pointerId) explicitly for drags, or releasePointerCapture if needed for cross-target movement. - Avoid duplicate events: On touch devices, browsers fire both pointer and legacy (mouse/touch) events; prevent compatibility mouse events by calling preventDefault on pointerdown. Implementation best practices: 1. Use pointerdown/pointermove/pointerup/pointercancel (handle both up and cancel for cleanup). 2. Set CSS touch-action: none (or specific like pan-x) on interactive elements to prevent default browser behaviors (scroll/zoom) without costly JS preventDefault. 3. Track pointers by pointerId (unique per contact) using Map/Set for multi-touch. 4. Feature detect: if ('PointerEvent' in window) { use pointer } else { fallback to mouse/touch }. 5. Prevent text selection: user-select: none; touch-action: none. Example drawing app (works on all devices): canvas.style.touchAction = 'none'; let ongoingTouches = new Map; canvas.addEventListener('pointerdown', (e) => { canvas.setPointerCapture(e.pointerId); // start drawing }); canvas.addEventListener('pointermove', (e) => { if (ongoingTouches.has(e.pointerId)) { // draw line } }); canvas.addEventListener('pointerup', cleanup); canvas.addEventListener('pointercancel', cleanup); This is the modern standard per MDN (universal support in Chrome 55+, Firefox 59+, Safari 13+), eliminating separate mouse/touch code paths.
Citations:
- 1: https://blog.carlosrojas.dev/the-complete-guide-to-pointer-events-21e44b2f9da0
- 2: https://developer.mozilla.org/en-US/docs/Web/Events/pointerdown
- 3: https://medium.com/@_ric/why-you-should-be-using-pointer-events-5b1e68171bac
- 4: https://developer.mozilla.org/en-US/docs/Web/API/Pointer_events
- 5: https://developer.mozilla.org/en-US/docs/Web/API/Touch_events/Using_Touch_Events
- 6: https://weblogtrips.com/technology/touch-events-vs-pointer-events-mobile-ui-2026/
- 7: https://developer.mozilla.org/en-US/docs/Web/API/Pointer_events/Using_Pointer_Events
Use pointerdown instead of mousedown for touch device compatibility.
The outside-dismiss handler is wired to mousedown, which does not fire on touch devices. The function is named onPointerDown but only handles mouse events. Change the event type to PointerEvent and the listener to "pointerdown" to support touch, pen, and mouse inputs uniformly (the modern standard for cross-device event handling).
Suggested fix
useEffect(() => {
if (!helpOpen) return;
function onKeyDown(e: KeyboardEvent) {
if (e.key === "Escape") setHelpOpen(false);
}
- function onPointerDown(e: MouseEvent) {
+ function onPointerDown(e: PointerEvent) {
const target = e.target as Node;
if (helpPopoverRef.current?.contains(target)) return;
if (helpButtonRef.current?.contains(target)) return;
setHelpOpen(false);
}
window.addEventListener("keydown", onKeyDown);
- window.addEventListener("mousedown", onPointerDown);
+ window.addEventListener("pointerdown", onPointerDown);
return () => {
window.removeEventListener("keydown", onKeyDown);
- window.removeEventListener("mousedown", onPointerDown);
+ window.removeEventListener("pointerdown", onPointerDown);
};
}, [helpOpen]);📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // Click-outside + Escape close the help popover. Window-level so the user | |
| // can dismiss from anywhere on the page; the listener tears down with the | |
| // component (and is a no-op while closed). | |
| useEffect(() => { | |
| if (!helpOpen) return; | |
| function onKeyDown(e: KeyboardEvent) { | |
| if (e.key === "Escape") setHelpOpen(false); | |
| } | |
| function onPointerDown(e: MouseEvent) { | |
| const target = e.target as Node; | |
| if (helpPopoverRef.current?.contains(target)) return; | |
| if (helpButtonRef.current?.contains(target)) return; | |
| setHelpOpen(false); | |
| } | |
| window.addEventListener("keydown", onKeyDown); | |
| window.addEventListener("mousedown", onPointerDown); | |
| return () => { | |
| window.removeEventListener("keydown", onKeyDown); | |
| window.removeEventListener("mousedown", onPointerDown); | |
| }; | |
| }, [helpOpen]); | |
| // Click-outside + Escape close the help popover. Window-level so the user | |
| // can dismiss from anywhere on the page; the listener tears down with the | |
| // component (and is a no-op while closed). | |
| useEffect(() => { | |
| if (!helpOpen) return; | |
| function onKeyDown(e: KeyboardEvent) { | |
| if (e.key === "Escape") setHelpOpen(false); | |
| } | |
| function onPointerDown(e: PointerEvent) { | |
| const target = e.target as Node; | |
| if (helpPopoverRef.current?.contains(target)) return; | |
| if (helpButtonRef.current?.contains(target)) return; | |
| setHelpOpen(false); | |
| } | |
| window.addEventListener("keydown", onKeyDown); | |
| window.addEventListener("pointerdown", onPointerDown); | |
| return () => { | |
| window.removeEventListener("keydown", onKeyDown); | |
| window.removeEventListener("pointerdown", onPointerDown); | |
| }; | |
| }, [helpOpen]); |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/web/src/screens/QuestionCard.tsx` around lines 81 - 101, The
outside-dismiss effect uses a MouseEvent listener named onPointerDown and
listens for "mousedown", which misses touch/pen input; update onPointerDown to
accept a PointerEvent (change its parameter type from MouseEvent to
PointerEvent), and change the event listener calls to use "pointerdown" instead
of "mousedown" in the useEffect; keep the same guard logic referencing
helpPopoverRef and helpButtonRef and ensure you update both addEventListener and
removeEventListener calls so the listener is properly cleaned up.
PR 58 review caught two real issues: **Question.tsx ArrowLeft/Right double-handling** RatingGroup's roving-tabindex onKeyDown calls preventDefault on ArrowLeft/Right to move focus between rating options. The window- level page-navigation handler in Question.tsx was firing for the SAME event, so pressing ArrowLeft on a focused rating both moved the focus ring AND navigated to the previous question. Add an `e.defaultPrevented` early return so child handlers consume the event first. **QuestionCard help popover dismiss missed touch** The click-outside handler used `mousedown` + `MouseEvent`. Mobile browsers do synthesize `mousedown` from touchstart in most cases, but `pointerdown` is the unified event spec for mouse / touch / pen and works consistently across input types without relying on compat shims. Switched event name + parameter type to PointerEvent. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…fety Five items from the review bundle: **Dismiss popover on screen-key + mode transitions (item 2).** An open glossary popover used to linger after the user committed an answer (advancing to the next question) — overlaying the next screen's content. A `useEffect` on `[showTiming, screen.key]` closes the popover on any transition that signals "user moved on": commit, Back, Skip, category jump, or mode flip. Matches the Slack / GitHub / Notion convention of closing transient popovers on user action. **Focus move into popover on open (item 6).** Keyboard-only users opening the help used to land nowhere — focus stayed on the trigger and Tab cycled through the page to reach the × button. Added a `closeRef` forwarded to the close button and a `useEffect` that focuses it on `helpOpen` true. Non-modal dialog pattern (per Radix / shadcn), Escape still dismisses from anywhere. **Viewport safety on popover width (item 7).** `max-w-[calc(100vw-2rem)]` caps the popover inside the viewport minus a margin, in case future card padding changes or very narrow devices would otherwise cause clipping. **Invariant comment on `e.detail === 0` (item 1).** Added a note about the programmatic `.click()` gotcha — `element.click()` also reports `detail === 0`, so test helpers that want to exercise the click path must use real mouse input (Playwright's locator `.click()` produces `detail ≥ 1`). **Drop updater form in CategoryWelcomeScreen (item 4).** `setIndex(() => firstQuestionIdx)` → `setIndex(firstQuestionIdx)`. Same for `goToFirstUnanswered`. Not a change in behavior; updater only needs the closure form when the setter depends on the previous value. **New E2E: help popover dismisses on commit and on Skip.** Extends fill-questionnaire.spec.ts — opens popover, presses "3" (keyboard commit), asserts dialog gone. Then opens again, clicks Skip, asserts dialog gone. Covers both transition classes from item 2. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Review item 4 (deferred from the previous commit). None of the setIndex calls here depend on the previous value — they jump to a specific index — so the `() => value` form was noise. Widen the prop type to accept plain values (matching React's native Dispatch<SetStateAction<number>> shape) and simplify the three call sites. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
🎉 This PR is included in version 1.11.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Playwright's getByRole defaults to substring matching on `name`, which caused group-cta.spec.ts to flake after PR #58 introduced a second "Review from the start" button: `{ name: "Start" }` matched both that button and the intended "Start" CTA, and the wrong element would detach mid-click → TimeoutError (3/3 recent main failures, all the same test + line). Sweep adds `exact: true` to all 155 call sites that use a string name. Regex names (7) are left alone — they already express intent explicitly. Playwright maintainers (microsoft/playwright#27483) have declined to change the default, and the documented community practice is per-call opt-in rather than a fixture wrapper, so the sweep is mechanical. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
* test(e2e): use exact name matching on getByRole across all specs Playwright's getByRole defaults to substring matching on `name`, which caused group-cta.spec.ts to flake after PR #58 introduced a second "Review from the start" button: `{ name: "Start" }` matched both that button and the intended "Start" CTA, and the wrong element would detach mid-click → TimeoutError (3/3 recent main failures, all the same test + line). Sweep adds `exact: true` to all 155 call sites that use a string name. Regex names (7) are left alone — they already express intent explicitly. Playwright maintainers (microsoft/playwright#27483) have declined to change the default, and the documented community practice is per-call opt-in rather than a fixture wrapper, so the sweep is mechanical. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * test(e2e): correct Fantasy radio label to match UI string The sweep to exact matching exposed that answerQuestionsCycling was targeting a radio named "Fantasy", but the actual UI label is "Fantasy only" (strings.ts:52). Substring matching had been hiding this all along. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Summary
Question-flow polish bundling the QA round + a few cleanups from review:
QA 4 · Progress link reads as clickable
QA 5 · Inline description with reserved slot
text-prettyhandles orphan avoidance.QA 6 · Suppress "New category" eyebrow when returning
QA 7 · α commit animation + keyboard listener refactor
commit-alphaovershoots and settles into the existing selected-answer ring — keyboard commits now have a visual beat before the advance.Question.tsx's window listener into two scoped components:RatingGroup(1-5) and a newTimingButtons(1/n, 2/l). Each owns its ownuseState<Rating | null>+onAnimationEnd-filtered commit flow. Mouse clicks stay instant. Reduced-motion: 1ms keyframe so the commit dispatches without visible motion.Welcome-screen state-aware CTA
/group's vocabulary:New: rating / timing glossary popover (Andrey's QA observation)
HelpCircleicon next to the Progress pill toggles a popover showing all options with their one-line meanings, sourced fromUI.intro.answers/UI.intro.timing(no new copy).Bonus: caching audit todo
Summary.tsxandReview.tsxuseMemoblocks listanswersas a dep butgetAnswers()returns fresh object identity each call, so the memos never cache. Filed as ap2follow-up intodo.mdcoveringuseSyncExternalStoremigration plus two adjacent cache wins (sortMembersViewerFirstmemo, question-by-id Map).Test coverage added
fill-questionnaire.spec.ts):admin-flow.spec.ts):question-with-description.png(desktop + mobile).question-with-help-popover.png(desktop + mobile, popover open).Test plan
pnpm -r typecheckpnpm test— 23 files / 406 testspnpm test:e2e— 5/5 in fill-questionnaire (covers new description + help)pnpm test:visual:docker— 18 passed (2 new snapshots × 2 viewports)🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Improvements