Skip to content

demo(contract-templates): Locate button to scroll to a field or clause (SD-3314)#3564

Merged
caio-pizzol merged 1 commit into
mainfrom
caio/contract-templates-locate
May 29, 2026
Merged

demo(contract-templates): Locate button to scroll to a field or clause (SD-3314)#3564
caio-pizzol merged 1 commit into
mainfrom
caio/contract-templates-locate

Conversation

@caio-pizzol
Copy link
Copy Markdown
Contributor

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).

  • Locate resolves the control by tag (selectByTag) and calls ui.contentControls.scrollIntoView({ id, block: 'center' })
  • Field rows are restructured so the button is a sibling of the input (a <label> may not contain interactive content)
  • Demo smoke test: clicking a lower clause's Locate scrolls its control into view

Verified: demo tsc --noEmit clean; demos/__tests__ contract-templates suite 2/2 (load + locate)

…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.
@caio-pizzol caio-pizzol requested a review from a team as a code owner May 29, 2026 14:00
@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 29, 2026

SD-3314

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@caio-pizzol caio-pizzol merged commit 3fbfa3f into main May 29, 2026
22 checks passed
@caio-pizzol caio-pizzol deleted the caio/contract-templates-locate branch May 29, 2026 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant