Skip to content

feat(theme): align the input recipes with the Open Components Input page - #367

Merged
alexgrozav merged 4 commits into
align-component-styles-uxf-487from
align-input-recipes-uxf-496
Oct 29, 2026
Merged

alexgrozav merged 4 commits into
align-component-styles-uxf-487from
align-input-recipes-uxf-496

Conversation

@alexgrozav

Copy link
Copy Markdown
Contributor

Description

The Input recipes now do their part of every stylesheet rule on the Open Components Input page. Most of the change is in the shared field factory (createFieldRecipe.ts), so the Textarea, Input Date and OTP cell recipes get it too.

  • Focus. The ring is @color.focus in every state. An invalid field no longer turns the ring red: it shows through the error border, doubled by a 1px inset shadow so the field doesn't grow.
  • State hooks. Beside the invalid, readonly and disabled axes, the wrapper reads the nested input's own aria-invalid="true", readonly and disabled attributes through .input:has(> .input-field[…]). Nothing styles :invalid or :read-only.
  • Hover. Every hover style is behind &:hover-capable:hover, and the dark ones behind &:dark:hover-capable:hover.
  • Size and touch. Each size has a min-height in rem. On touch screens the input's text is at least 16px, and the input reaches past the field to a 44px hit area through a transparent border pulled back by a negative margin, so nothing moves.
  • Forced colours and more contrast. In forced colours the focus ring is Highlight and a disabled field turns GrayText at full opacity. With prefers-contrast: more, the two gray levels the borders use resolve to the text colour inside the field, so every border is drawn at full strength in every state.
  • Contrast. The placeholder, prefix and suffix are the field's text colour at 75% (color-mix), which keeps 4.5:1 on every colour, variant and mode. The read-only state keeps the fill instead of tinting it, and the light and dark ghost fields take their own fill on a page of the other mode, since their text sat on a page of the same lightness before (about 1:1).
  • Right to left. The prefix and suffix use padding-inline-end and padding-inline-start.

fieldSurfaceContrast.test.ts now checks the value, the muted text, every border, the invalid border and the focus ring in both themes, and useInputRecipe.test.ts has one test per rule, named by its rule ID. The Storybook stories have a visible label for every input, an error message linked to the invalid one, and a Focus story. The docs page's Accessibility section says what the recipe does for each group of rules.

Related issue

Part of aligning the component recipes with the Open Components standard.

Type of change

  • 🐞 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that changes existing behavior)
  • 📖 Documentation
  • ♻️ Refactor / internal (no functional change)
  • 🔧 Build / tooling / CI

Checklist

  • My commits follow Conventional Commits with a package scope (e.g. feat(theme): …)
  • I ran pnpm build:nodocs && pnpm lint && pnpm typecheck && pnpm test and everything passes (ran per package instead: the theme's typecheck, tests and build, the Storybook build and its vue-tsc count, the docs build and test:build, and oxlint and oxfmt on the touched files)
  • I added a changeset (pnpm changeset) for changes to publishable packages, or this change only touches docs/storybook/app/playground/tests
  • I added or updated tests where relevant
  • I updated documentation where relevant
  • I did not edit generated files (dist/, .styleframe/)
  • My PR targets main and stays focused in scope (it targets the integration branch align-component-styles-uxf-487)

Notes / screenshots

  • No recipe, axis, value, default, export, token or modifier is renamed or removed, so the changeset is a patch. Two internal factory signatures changed, neither exported from the package: fieldSurfaceCompoundVariants drops its focusModifier option, which only set the red invalid ring, and createFieldAddonRecipe takes paddingInlineStart or paddingInlineEnd. That is why useOtpCellRecipe.ts and the textarea prefix and suffix files change by one line each.
  • The OTP cell's own @color.primary ring is left as it is.
  • The Input Date, Textarea and OTP docs pages had sentences about the red invalid ring and the read-only tint, which are no longer true, so those sentences are corrected.
  • axe reports no violations on any of the 20 Input stories, in light and dark.

The field surface now meets the Input page's stylesheet rules. The focus
ring is color.focus in every state, and invalid shows through the error
border and an inset shadow. The wrapper reads aria-invalid, readonly and
disabled from the nested input through :has(), hover styles sit behind
hover-capable, and sizes get a min-height. On touch screens the input's
text is at least 16px with a 44px hit area. Disabled fields turn GrayText
in forced colors, and borders use the text color with more contrast.

The placeholder, prefix and suffix take the field's text color at 75%,
the prefix and suffix use logical padding, the read-only state keeps the
fill, and light and dark ghost fields take their own fill on a page of
the other mode, so text keeps 4.5:1 in both themes. Textarea, input-date
and the OTP cell share the surface and get the same changes.
The prefers-contrast override wrote the --color--gray-450 and --color--gray-500 names by hand, so an instance with its own variable naming kept the faint borders. It now sets the two variables through variable(), which follows the instance's naming.
@vercel

vercel Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
styleframe-dev Ready Ready Preview Oct 29, 2026 3:18pm UTC
styleframe-dev-storybook Ready Ready Preview Oct 29, 2026 3:18pm UTC

Request Review

…ld docs

The 16px touch-screen text sat on every field's nested control, so on the Input Date it grew only the separators. It now sits in the Input recipe beside the touch hit area. The Input Date and OTP pages, the Input page and the changeset no longer claim a red invalid ring, a primary ring on the wrapper or a ghost without a fill, and each story's input has its own id.
The large field is already taller than the input's 44px hit area, so the docs and the recipe comment no longer say it reaches past the field, and the story comment says the docs page shows the primary story's id twice.
@alexgrozav
alexgrozav merged commit 5b9b395 into align-component-styles-uxf-487 Oct 29, 2026
3 checks passed
@alexgrozav
alexgrozav deleted the align-input-recipes-uxf-496 branch October 29, 2026 18:51

This branch was successfully deployed

2 active deployments
Preview – styleframe-dev — aa38dd36 Deployed Oct 29, 2026 by vercel[bot]
Preview – styleframe-dev-storybook — aa38dd36 Deployed Oct 29, 2026 by vercel[bot]
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.

1 participant