Skip to content

Form style updates#1031

Merged
pyrello merged 29 commits into4.xfrom
form_finish
Mar 17, 2026
Merged

Form style updates#1031
pyrello merged 29 commits into4.xfrom
form_finish

Conversation

@bspeare
Copy link
Copy Markdown
Contributor

@bspeare bspeare commented Jan 20, 2026

Resolves #1021

To test

  • Look at the forms under
    • Components -> Form -> filters
    • Form -> Kitchen sink
    • Components -> Form -> filters
    • Showcase -> Application -> Directory
    • Showcase -> Application -> Form
    • Showcase -> Forms -> Information Request Form
  • Check the individual form elements
  • Verify that the chagnes complete a coherent update that addresses the most common inputs and controls for forms
  • Verify internal style and code consistency.
  • Do accessibility checks.

@bspeare bspeare mentioned this pull request Jan 20, 2026
11 tasks
pyrello and others added 24 commits January 21, 2026 12:05
Rename utility-style classes to proper BEM modifiers/elements:
- .form-type-checkbox → .form-item--checkbox
- .form-type-radio → .form-item--radio
- .form__checkbox--switch → .form-item--toggle
- .form-actions → .form__actions
- .error → .form--error

Add missing accessibility states:
- Focus states for checkbox/radio inputs
- Error states for checkbox/radio inputs
- Focus state for file inputs
- Error state for toggle switches

Remove undefined .form--small reference and unused .form-autocomplete class.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…tate

- Rename remaining non-BEM classes (form-type-checkbox, details-wrapper,
  description) to proper BEM equivalents
- Add select to disabled/readonly styling rule
- Set form button height to match --form-input-height with flex centering
- Include [type=reset] in form button rules
- Exclude submit/button/reset from form--large padding-inline-start
- Remove bttn--large from button stories (size comes from form context)
- Remove unused .field-prefix/.field-suffix with breaking change note

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This selector was a Drupalism that leaked in from SiteNow via copy/paste.
UIDS should not have Drupal-specific selectors - SiteNow's uids_base
theme can handle this if webforms rely on it.

The .form--inline modifier provides the canonical way to achieve
side-by-side checkbox/radio layouts.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The sidebar legend pattern (legend floats to the side at wider viewports)
was previously implicit when using .form--inline or .form--flex on a
fieldset. This changes it to an explicit opt-in via .form-fieldset--sidebar-legend.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Renames sidebar-legend → side-legend to avoid confusion with sidebar
navigation elements. Adds sideLegend prop to FormFieldset and
demonstrates pattern in Filters story.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove margin-top from .form-item/.form__actions (margin-bottom only)
- Remove row-gap from .form--flex/.form--inline contexts
- Simplify .form--compact to only zero margin-block-end

This makes spacing consistent across stacked and flex layouts.
Note: side-legend pattern needs follow-up fix for flex context.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…ern. Also switch to using bottom margin only for spacing for better consistency.
Add the HTML required attribute to form controls when the Required
toggle is enabled in Storybook. Previously, the toggle only controlled
the visual asterisk (.form--required class) on labels.

This demonstrates the accessibility best practice of using the required
attribute on native form elements for screen reader announcement.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sets form buttons to 1.05rem by default (matching bttn--small), with
1.25rem for .form--large (matching bttn default). Uses CSS variable
for consistency with other form sizing.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…stead of eliminating

Replace hardcoded 1rem margins with --form-item-margin CSS variable so
.form--compact can override to 0.5rem (halved) instead of zeroing spacing.
Also simplify input margin (wrapper handles spacing), remove description
bottom margin and input+description offset for cleaner vertical rhythm.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The form-fieldset__content wrapper div was always rendered, breaking
inline layout for checkbox/radio groups. Now only renders when
sideLegend is true. Update checkbox/radio story to apply form--inline
as a CSS class instead of a component prop.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Set label to display: block with 0.25rem bottom margin for consistent
spacing between labels and their controls. Add 0.5rem bottom margin to
fieldset legends to match. Remove line-height: 1.8 on labels (was
providing implicit spacing). Zero out legend margin in side-legend
container query context where it sits inline.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@GaryRidgway GaryRidgway marked this pull request as ready for review February 18, 2026 21:37
@GaryRidgway GaryRidgway marked this pull request as draft February 18, 2026 22:15
@GaryRidgway GaryRidgway self-assigned this Feb 27, 2026
@GaryRidgway GaryRidgway removed their assignment Mar 5, 2026
@GaryRidgway
Copy link
Copy Markdown
Contributor

Added fixes for some things raised in Denny's feedback, and added future potential changes in a comment here.

@GaryRidgway
Copy link
Copy Markdown
Contributor

Decided to take the range slider out, but I also made an example slider element that matches a lot of our styles while making a larger hitbox if we want to implement it in the future.

Example here

rangeslider

CSS here
// === Range specific === //
.form-item [type='range'] {
  appearance: none;
  box-sizing: border-box;
  height: 32px;
  display: flex;
  align-items: center;
  position: relative;
  border-radius: 50px;
  overflow: hidden;
  outline: none;
  border: none;
  padding: 0 2px;
  cursor: pointer;
  background-color: var(--uids-gray-light);
  transition: background-color ease 0.3s;
  margin-top: 0;

  &:focus-visible {
    background: variables.$light;
    outline: 1px solid variables.$secondary;
  }

  &.form--error {
    background-color: variables.$danger-light;
    outline: 2px solid variables.$danger;
  }


  &::-webkit-slider-thumb {
  }

  &::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 28px;
    height: 28px;
    background: #fff;
    top: 2px;
    border-radius: 50%;
    //border: 2px solid var(--brand-primary);
    //box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    transition: all cubic-bezier(0.3, 1.5, 0.7, 1) 0.3s;
    box-shadow:
      0 1px 2px rgba(0, 0, 0, 0.2),
      -10015px 0 0 9999px var(--brand-primary),
      0 0 0 2px var(--brand-primary);

    &:before {


    }
  }
}
// === End: Range specific === //

@GaryRidgway GaryRidgway requested a review from a team March 6, 2026 18:50
@GaryRidgway GaryRidgway marked this pull request as ready for review March 9, 2026 14:01
@joewhitsitt joewhitsitt self-assigned this Mar 12, 2026
@joewhitsitt
Copy link
Copy Markdown
Contributor

joewhitsitt commented Mar 12, 2026

My IDE notes some deleted, unused stuff in src/components/form/ExampleFiltersForm.vue

Screenshot 2026-03-12 at 2 15 49 PM

Same for button on src/components/form/FormFieldset.vue

Should the form collapsible stuff be completely removed or left for later? (e.g. .form-collapsible__wrapper css) - f3ceeb6

@joewhitsitt
Copy link
Copy Markdown
Contributor

joewhitsitt commented Mar 12, 2026

My design eye might not catch the style consistency but on glance it looks purty!

http://localhost:6006/?path=/story/showcase-forms--information-request-form has the form--require class but not the required attribute like http://localhost:6006/?path=/story/elements-form--text&args=required:!true

Accessibility scans using siteimprove, lighthouse, webaim and ainspector all return good (except for the absence of higher up DOM necessities)

@GaryRidgway
Copy link
Copy Markdown
Contributor

My IDE notes some deleted, unused stuff in src/components/form/ExampleFiltersForm.vue

Screenshot 2026-03-12 at 2 15 49 PM Same for button on src/components/form/FormFieldset.vue

Should the form collapsible stuff be completely removed or left for later? (e.g. .form-collapsible__wrapper css) - f3ceeb6

good catch Joe, I can go in and remedy the things you have noticed and pass it back. thanks for checking things!

@joewhitsitt
Copy link
Copy Markdown
Contributor

I am going to remove myself from review because I am out Monday, but happy to re-assign if it is still outstanding on Tuesday.

@joewhitsitt joewhitsitt removed their assignment Mar 13, 2026
@joewhitsitt joewhitsitt self-assigned this Mar 17, 2026
Copy link
Copy Markdown
Contributor

@joewhitsitt joewhitsitt left a comment

Choose a reason for hiding this comment

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

Thanks for the extra clean up. As reviewed before the a11y checks passed and things look good/correct. Without more guidance with the testing instructions I am not sure what else to look for.

@joewhitsitt joewhitsitt removed their assignment Mar 17, 2026
@pyrello pyrello merged commit 7bafeb8 into 4.x Mar 17, 2026
2 checks passed
@pyrello pyrello deleted the form_finish branch March 17, 2026 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Finish defining form styles

4 participants