Repository navigation
feat(ui): add-question configure step; insert after the current row; scroll to and highlight the new row (#17) - #26
Open
PrjShrestha wants to merge 1 commit into
Open
PrjShrestha wants to merge 1 commit into
PrjShrestha wants to merge 1 commit into
Conversation
…scroll to and highlight the new row (#17) Clicking a type tile in the add-question picker committed immediately: no step for required, hint or validation, and the new row was appended after the hidden __* outputs, off-screen, with no scroll and no highlight (UX review finding 3, P0). QuestionTypePicker: a `configure` step between a question tile and the commit — required, a hint per visible language, and a Validation slot (constraint expression with the existing "✎ build" modal, plus a constraint_message per language; 9e replaces the slot with presets). Enter anywhere commits. "add without details" is the one-click behaviour for this question; "Always skip this step" remembers it (localStorage `cht-ui-builder.oneClickTiles`). Structural tiles, the lineage sentinel, hidden rows and edit-type reopens never get the step. A select's choices step leads into the configure step the same way. PickerCommit gains an optional `details` block; FormEditor writes `required = yes`, `hint::<loc>`, `constraint`, `constraint_message::<loc>` only for the values the author set, so an untouched step adds exactly the row the one-click flow added. Insert position: "+ Question" lands directly after the row the author is on (the last focused card, tracked by a focus-capture on the survey tab), via the new shared `insertIndexAfterRow` (surveyEdits.ts, node-tested). A begin-group row counts as "inside the group" (first child), any other row is followed by its new sibling, so every pair stays balanced. With no current row it falls back to `defaultInsertIndex` (before the trailing plumbing calculates). After commit the new row is scrolled into view, focused and flashed for 2.5 s; a row hidden in Simple mode flips the editor to Full first. The Validation slot's field list is the same dependency-ordered, unique-name, non-plumbing list the row card uses (`pickableFieldsBefore`, now one function), computed for the insert position. Tests: surveyEdits.insertAfter.test.ts (after a top-level row, inside a group, after a begin row, trailing-plumbing fallback, unknown id; each asserting structural balance). Playwright add-question-configure.spec.ts: age (integer) with required, hint, constraint and message lands right after lmp_date, flashed and in view, with those cells on disk and every other row's cells unchanged; "add without details"; a question added while on a row inside a group lands inside, after it, balanced; the remembered preference commits on the tile click. Suite: the build specs were written against one-click tiles, so the Playwright profile seeds the preference ON (storageState in playwright.config.ts, which also covers specs that bypass setup.ts); the new spec clears it. demo-1's row-order expectations now reflect insert-after-current-row. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
PrjShrestha
added a commit
that referenced
this pull request
Oct 1, 2026
… while the four PRs are open Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This was referenced Oct 1, 2026
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.
Closes #17 (T9d). Parent epic #9. Plan:
docs/plans/9_complex_logic_calculation_relevant_constraint/README.md(on the T9 docs branch). Independent of #23 / #24 / #25; branched frommaster.What
Configure step. After a question tile (or a select's choices step), the picker shows one more step before committing: required, a hint per visible language, and a Validation slot (constraint expression with the existing "✎ build" modal, plus a
constraint_messageper language). 9e replaces the slot with presets. Enter anywhere commits. "add without details" is the one-click behaviour for that question; "Always skip this step" remembers it. Structural tiles, the lineage sentinel, hidden rows and edit-type reopens never get the step. The row is written withrequired = yes,hint::<loc>,constraintandconstraint_message::<loc>only for the values the author set, so an untouched step adds exactly the row the one-click flow added.Insert after the current row. "+ Question" lands directly after the row the author is on (the last focused card), via a new shared
insertIndexAfterRow(node-tested). A begin-group row counts as "inside the group"; any other row is followed by its new sibling, so every pair stays balanced. With no current row it falls back to the existingdefaultInsertIndex.Scroll and highlight. After commit the new row is scrolled into view, focused and flashed for 2.5 s; a row that Simple mode would hide flips the editor to Full first.
The Validation slot builds against the same dependency-ordered, unique-name, non-plumbing field list the row card uses, now one function (
pickableFieldsBefore), computed for the insert position.Tests
surveyEdits.insertAfter.test.ts: after a top-level row, after a row inside a group, after a begin row, trailing-plumbing fallback, unknown id; each asserts structural balance of the spliced survey.add-question-configure.spec.ts(Playwright): add age (integer) with required, hint, a constraint and a message while onlmp_date; it lands right after, flashed and in view; the sheet has those cells and every other row's cells are unchanged. "add without details" adds the plain row. A question added while on a row inside a group lands inside, right after it, balanced, and saves. The remembered preference commits on the tile click.Suite note. Thirteen build specs click tiles expecting an immediate commit. Rather than rewrite forty-odd call sites, the Playwright profile seeds the "always skip" preference ON (
storageStateinplaywright.config.ts, which also covers the specs that bypasssetup.ts); the new spec clears it to drive the step.demo.spec.ts's row-order expectations now reflect insert-after-current-row (that spec already fails later onmaster, see below).Validate
pnpm typecheckpnpm lintmasteralready (164 problems in untouched files); the new files lint clean, the touched legacy files add no new problemspnpm --filter @cht-ui/shared build && testadd-question-configure,form-editing,condition-builder,pick-preexisting-values,form-data-passing,demo,geriatric-builddemo1 & 4 ("add inside", "+ Type") andgeriatric-buildlines 468 & 492, all four failing identically on a cleanmasternode scripts/corpus-sweep.mjsmaster🤖 Generated with Claude Code