astryx icon indicating copy to clipboard operation
astryx copied to clipboard

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

Open Geervan opened this issue 4 months ago • 5 comments

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.

Geervan avatar Jul 23 '26 05:07 Geervan

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

Project Deployment Actions Updated (UTC)
astryx Error Error Aug 2, 2026 7:26pm

Request Review

vercel[bot] avatar Jul 23 '26 05:07 vercel[bot]

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

github-actions[bot] avatar Jul 23 '26 05:07 github-actions[bot]

yep imma make the changes, thanks!

Geervan avatar Jul 28 '26 05:07 Geervan

so like should i make the changes or will this get merged? i am kinda confused sorry

Geervan avatar Jul 28 '26 17:07 Geervan

Thanks @cixzhang! I've updated the PR to pass xstyle={styles.spinnerIcon} directly to , removing the extra wrapper and keeping the DOM element count low. The diff has been cleaned up as well. Ready for review/merge!

Geervan avatar Aug 02 '26 18:08 Geervan

Hello, @cixzhang I was wondering if looking at this fix is on the list or did it become obsolete, im sorry to interrupt but its been quite a while, so thought of writing this up

Geervan avatar Aug 11 '26 20:08 Geervan