Skip to content

fix(core): align loading spinner inside TextArea corner (#4232)#4244

Open
Geervan wants to merge 2 commits into
facebook:mainfrom
Geervan:fix/textarea-isloading-spinner-alignment
Open

fix(core): align loading spinner inside TextArea corner (#4232)#4244
Geervan wants to merge 2 commits into
facebook:mainfrom
Geervan:fix/textarea-isloading-spinner-alignment

Conversation

@Geervan

@Geervan Geervan commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #4232.

In TextArea's isLoading (busy) state, the loading Spinner was previously rendered without positioning container styles, causing it to fall into normal flow outside the field wrapper or overlap scrollbars.

This PR updates TextArea to anchor the loading spinner inside the top-right corner of the field wrapper using flex alignment, matching the status icon layout without interfering with native vertical scrollbars.


Changes Made

  • packages/core/src/TextArea/TextArea.tsx:
    • Wrapped Spinner in a spinnerIcon <span> styled as a flex item (alignSelf: 'flex-start', marginInlineStart: spacingVars['--spacing-2']).
    • Gated status icon rendering (status && !isBusy) so the busy spinner takes precedence without overlapping validation icons.
    • Kept <textarea> in flex flow (flex: 1) so native scrollbars remain contained inside <textarea> and do not overlap the spinner.
  • apps/storybook/stories/TextArea.stories.tsx:
    • Added isLoading controls and the IsLoading story for visual testing.
  • packages/core/src/TextArea/TextArea.test.tsx:
    • Added unit test coverage asserting isLoading renders the positioned spinner container and suppresses status icons.

Test Plan

  1. Automated Tests:
    • Executed npx vitest run packages/core/src/TextArea/TextArea.test.tsx (59/59 passed).
  2. Visual Inspection:
    • Verified <TextArea isLoading /> in Storybook (http://localhost:6006/?path=/story/textarea--is-loading).
    • Verified spinner remains anchored inside the top-right corner without overlapping vertical scrollbars when text overflows.

@vercel

vercel Bot commented Jul 23, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
astryx Ready Ready Preview, Comment Jul 23, 2026 5:44am

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jul 23, 2026
@github-actions github-actions Bot added community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge needs:design-review Affects visuals — Design should review labels Jul 23, 2026
@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

PR Analysis Report

Modified Components

Field
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 505 -
Complexity N/A Very High (31) -
TextArea
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 357 -
Complexity N/A Very High (45) -

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.7KB 0B

Accessibility Audit

Status: 1 accessibility violation(s) found — 1 serious.

TextArea - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/26 stories · Learn more
    • WCAG: 1.4.3 (Level AA)

Generated by PR Enrichment workflow | View full report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] TextArea: isLoading spinner is misaligned — should sit inside the resizable textarea (like the status icon)

1 participant