Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: highlight missed required Template Builder fields - #28929

Closed
aqandrew wants to merge 1 commit into
mainfrom
feat/highlight-missed-required
Closed

feat: highlight missed required Template Builder fields#28929
aqandrew wants to merge 1 commit into
mainfrom
feat/highlight-missed-required

Conversation

@aqandrew

@aqandrew aqandrew commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

What

Highlights missed required fields in the template builder. An empty required field flips to the destructive red outline (aria-invalid + border-border-destructive) once the user either scrolls past it or reaches the bottom of the page, and the cue clears the moment the field has a value.

Resolves DEVEX-832. This is an isolated slice of #27077 (its item 7), rebased onto current main.

Implementation note: no new custom hooks

#27077 introduced two custom hooks (useHasBeenScrolledPast, useHasReachedBottom). Per the request, this PR delivers the same behavior without adding any new custom React hooks:

  • The per-field "scrolled past" detection is inlined directly in FormField using built-in hooks (useRef + useState + useEffect with a sticky IntersectionObserver).
  • The window-level "reached bottom" signal is a context + provider component (HasReachedBottomContext / HasReachedBottomProvider), consumed via useContext(HasReachedBottomContext) — no useX wrapper hook.

Changes

  • FormField: new opt-in markInvalidWhenScrolledPastEmpty prop. When set, an empty required field becomes aria-invalid once scrolledPast || hasReachedBottom. Default behavior (error-driven aria-invalid) is unchanged.
  • HasReachedBottomContext.tsx (new): context + provider component tracking whether the window has been scrolled to the bottom at least once (sticky). Not a hook.
  • ConfigurationField: enables the prop on the module/base text fields, so every module and base-template required text param gets the cue for free.
  • TemplateBuilderPageView: wraps step content in HasReachedBottomProvider, keyed by currentStep.id so the signal resets on each step.
  • OrganizationAutocomplete: adds aria-invalid support (destructive border on the trigger).
  • TemplateCustomizationsStep: enables the cue on the ID field and flags the required Organization autocomplete once the page bottom is reached with nothing selected.

Testing

  • pnpm check (biome) clean
  • pnpm lint:types (tsc) clean
  • pnpm vitest run --project=storybook src/components/FormField — 9 pass, incl. new RequiredMissHighlightedAtBottom / RequiredMissClearedWhenFilled interaction stories
  • pnpm vitest run --project=storybook src/pages/TemplateBuilder src/components/OrganizationAutocomplete — pass
  • pnpm vitest run --project=unit src/pages/TemplateBuilder — 61 pass
Behavior / scope notes

Coder Agents generated, on behalf of @aqandrew.

Empty required template-builder fields flip to the destructive outline
once the user scrolls past them or reaches the bottom of the page, and
clear as soon as they get a value.

Implemented without new custom hooks: FormField gains an opt-in
markInvalidWhenScrolledPastEmpty prop backed by an inline
IntersectionObserver, plus a HasReachedBottomContext provider component
consumed via useContext. Enabled for all module/base text params via
ConfigurationField, and for the Customizations ID and Organization
fields (OrganizationAutocomplete gains aria-invalid support).

Isolated slice of #27077 (item 7). DEVEX-832.
@linear-code

linear-code Bot commented Sep 3, 2026

Copy link
Copy Markdown

DEVEX-832

@aqandrew aqandrew changed the title feat(site/src/pages/TemplateBuilder): highlight missed required fields feat: highlight missed required Template Builder fields Sep 3, 2026
@aqandrew

aqandrew commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

closing in favor of #28940

@aqandrew aqandrew closed this Sep 4, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 4, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant