Skip to content

feat(theme): align the textarea recipe with Open Components - #380

Merged
alexgrozav merged 2 commits into
align-component-styles-uxf-487from
align-textarea-recipes-uxf-503
Oct 29, 2026
Merged

alexgrozav merged 2 commits into
align-component-styles-uxf-487from
align-textarea-recipes-uxf-503

Conversation

@alexgrozav

@alexgrozav alexgrozav commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Description

Brings useTextareaRecipe in line with the stylesheet rules on the Open Components Textarea page, on top of the shared field surface the Input change already aligned.

  • Min rows. The nested textarea gets min-height: calc(attr(rows type(<number>), 2) * 1lh), so resizing or growing never makes it shorter than its rows. Browsers without typed attr() drop the declaration, and rows still sets the starting height.
  • Auto-grow. A new autogrow axis, false by default, adds a -autogrow marker. Inside @supports (field-sizing: content), it sets field-sizing: content, turns resizing off and caps max-height at the rows in the textarea's data-max-rows. Without field-sizing the textarea keeps its resize handle.
  • Touch. On @media (any-pointer: coarse) the textarea's text is at least 16px, and the textarea itself, which takes the tap, is at least 44px tall, whatever its rows.
  • Block resize. vertical stays the default value, and now also emits resize: block inside @supports (resize: block), so it follows the writing mode. none, horizontal and both stay for compatibility, and the docs say they don't meet the rule.
  • Verified for the textarea: the @color.focus ring in every state, the :has() state hooks, hover behind hover-capable, forced colors, more contrast and logical padding.
  • Tests. One per rule, named by its rule ID, plus textareaContrast.test.ts for every color × variant in both themes, the placeholder and a count in the suffix included.
  • Storybook. Every example has a visible label. There are new Focus and AutoGrow stories, and the Invalid story has an error message. The textarea gets dir="auto".
  • Docs. The Textarea page has a new Auto-grow section and an updated Accessibility section.

Related issue

None.

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
  • 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

Notes / screenshots

  • Build, lint and typecheck pass. pnpm test passes except apps/playground/test/theme.test.ts, which fails the same way on the base branch under Node 26 (localStorage is not available without --localstorage-file).
  • This PR targets the integration branch for the component alignment work, not main.
  • The changeset is minor because of the new autogrow axis. No axis, value, default or export is renamed or removed.
  • textarea/count and textarea/announce-count need script, so they stay with the UI libraries. Over the limit, the textarea's aria-invalid="true" gives it the invalid look.

The textarea now meets the stylesheet rules on the Open Components Textarea page. It's never shorter than its rows, since the nested textarea gets a min-height of its rows in lines. On touch screens its text is at least 16px and the field at least 44px tall. A new autogrow axis, off by default, grows it with its text through field-sizing up to its data-max-rows, in browsers that support field-sizing. Tests cover each rule by its ID, a contrast test covers every color and variant in both themes, and the Storybook examples now label every textarea.
@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 8:29pm UTC
styleframe-dev-storybook Ready Ready Preview Oct 29, 2026 8:29pm UTC

Request Review

…n the block axis

On touch screens the 44px minimum sat on the wrapper, so a one-row textarea was only a 24px target. The nested textarea now gets it, keeping its rows where typed attr() works. The vertical resize default also sets resize: block where browsers support it, so it follows the writing mode. The docs count 17 compound entries and cite their browser-support claims.
@alexgrozav
alexgrozav merged commit c38bd3b into align-component-styles-uxf-487 Oct 29, 2026
3 checks passed
@alexgrozav
alexgrozav deleted the align-textarea-recipes-uxf-503 branch October 29, 2026 20:32

This branch was successfully deployed

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