demo(contract-templates): Locate button to scroll to a field or clause (SD-3314)#3564
Merged
Merged
Conversation
…ntrol
Each field row and clause card gets a Locate button that resolves the control
by tag (selectByTag) and calls ui.contentControls.scrollIntoView({ id, block:
'center' }) - dogfooding the shipped SD-3310 API in the demo. Scroll-only
("Locate", not focus; focus/activate is SD-3312). Adds a demo smoke asserting
that clicking a lower clause's Locate scrolls its control into view.
There was a problem hiding this comment.
cubic analysis
No issues found across 3 files
Linked issue analysis
Linked issue: SD-3314: contract-templates demo: Locate (scroll-to) for fields and clauses
| Status | Acceptance criteria | Notes |
|---|---|---|
| ✅ | Add a "Locate" button on each field row that scrolls the document to that field's content control | Fields panel markup now includes a Locate button per field and an event listener that calls locateByTag for the field. |
| ✅ | Add a "Locate" button on each clause card that scrolls the document to that clause's content control | Clause card templates include a Locate button and the clause cards attach a click handler that calls locateByTag with the clause tag. |
| ✅ | Locate is scroll-only and uses the public scrollIntoView API (does not move the cursor into the control) | locateByTag resolves control by tag then calls ui.contentControls.scrollIntoView with block: 'center'; comments and code indicate it does not activate/focus the control. |
| ✅ | Field rows restructured so the Locate button is a sibling of the input (avoid interactive inside ) | Fields row changed from a wrapper to a with an explicit and a sibling Locate . |
| ✅ | Include a demo smoke test that clicking a lower clause's Locate scrolls its control into view | A Playwright test was added which verifies the bottom clause starts off-screen, clicks its Locate button, and asserts the clause's painted element becomes visible. |
Tip: cubic could auto-approve low-risk PRs like this, if it thinks it's safe to merge. Learn more
Re-trigger cubic
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.
The contract-templates demo is our showcase for building custom UI on content controls, but nothing in it demonstrated jumping to a control from the side panel. This adds a Locate button on each field row and clause card that scrolls the document to that control - dogfooding the scroll-to API shipped in SD-3310 in a realistic sidebar.
It is scroll-only and named "Locate", not "Focus": it scrolls to the control but does not move the cursor into it. Building it surfaced the next two gaps in a real consumer - overlays drift while the document scrolls because there is no single geometry-change signal (SD-3311), and you cannot start editing right after locating because the cursor is not placed (SD-3312).
selectByTag) and callsui.contentControls.scrollIntoView({ id, block: 'center' })<label>may not contain interactive content)Verified: demo
tsc --noEmitclean;demos/__tests__contract-templates suite 2/2 (load + locate)