Skip to content

fix: textarea overflow, default rows, and size/variant API#738

Open
rohanchkrabrty wants to merge 2 commits intomainfrom
feat/645-textarea-overflow-rows-api
Open

fix: textarea overflow, default rows, and size/variant API#738
rohanchkrabrty wants to merge 2 commits intomainfrom
feat/645-textarea-overflow-rows-api

Conversation

@rohanchkrabrty
Copy link
Copy Markdown
Contributor

Summary

  • Fix overflow: hidden on textarea CSS -- changed to overflow: auto so users can scroll when content exceeds the visible area
  • Replace CSS min-height with native rows attribute -- removed hardcoded min-height: var(--rs-space-13) and set rows={3} as default, allowing users to override with <TextArea rows={6} />
  • Add size and variant CVA variants to align TextArea API with InputField -- supports size="small" | "large" and variant="default" | "borderless" with matching defaults (size: 'large', variant: 'default')

Test plan

  • All 23 TextArea tests pass (including 8 new tests for rows, sizes, and variants)
  • Full test suite passes (1625 tests across 70 files)
  • No new TypeScript errors introduced
  • Verify textarea renders with default 3 rows height
  • Verify <TextArea rows={6} /> renders taller than default
  • Verify size="small" applies smaller padding
  • Verify variant="borderless" removes borders
  • Verify scrollbar appears when content overflows

Closes #645

🤖 Generated with Claude Code

Fix overflow: hidden preventing scroll, replace CSS min-height with
native rows attribute (default 3), and add size/variant CVA variants
to align TextArea API with InputField.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 14, 2026

📝 Walkthrough

Walkthrough

This pull request enhances the TextArea component by adding size, variant, and rows props to align its API with the InputField component. The size prop supports 'large' (default) and 'small' values with corresponding CSS styling, the variant prop supports 'default' and 'borderless' options, and the rows prop controls textarea height with a default of 3 rows. The overflow behavior is fixed by changing CSS from overflow: hidden to overflow: auto. Documentation is expanded with new code examples and dedicated sections for each feature. Tests are added to verify correct CSS class application for each prop combination.

Suggested reviewers

  • rsbh
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the three main changes: fixing textarea overflow, adding default rows support, and introducing size/variant API.
Description check ✅ Passed The description clearly relates to the changeset, detailing the overflow fix, rows attribute change, and size/variant CVA additions with test verification.
Linked Issues check ✅ Passed The PR addresses core objectives from #645: overflow is fixed (overflow: auto), rows attribute enables height control (replacing min-height), and size/variant CVA variants align the API with InputField.
Out of Scope Changes check ✅ Passed All changes are scoped to the textarea component improvements specified in #645. Accessibility and design token work were appropriately deferred to cross-cutting issues #672 and #673.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 14, 2026

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

Project Deployment Actions Updated (UTC)
apsara Ready Ready Preview, Comment Apr 15, 2026 9:05pm

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/raystack/components/text-area/text-area.tsx (1)

35-47: Prefer explicit rows default in props destructuring.

Right now the default rows value is implicit via rows={3} plus {...props} override order. Making rows explicit in the function signature improves readability and avoids subtle override behavior.

Suggested refactor
 export function TextArea({
   className,
   style,
   disabled,
   width = '100%',
+  rows = 3,
   value,
   onChange,
   placeholder,
   required,
   size,
   variant,
   ...props
 }: TextAreaProps) {
@@
     <textarea
-      rows={3}
+      rows={rows}
       className={cx(
         textAreaVariants({ size, variant }),
         disabled && styles.disabled,
         className
       )}

Also applies to: 53-66

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/raystack/components/text-area/text-area.tsx` around lines 35 - 47,
The TextArea component currently relies on an implicit default for rows via
rows={3} merged from {...props}; update the TextArea function signature to
destructure rows with an explicit default (e.g., rows = 3) alongside other props
so the default is obvious and cannot be accidentally overridden by spread order;
locate the TextArea function (export function TextArea) and remove or adjust any
later rows={3} usage so the component uses the destructured rows value when
rendering the underlying textarea.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/raystack/components/text-area/text-area.module.css`:
- Around line 90-93: The CSS for .variant-borderless currently removes the
border and outline on focus, making keyboard focus invisible; update the focus
rule for .variant-borderless:focus:not(:disabled) to keep a visible focus
indicator (e.g., use a non-transparent border-color, box-shadow, or outline with
accessible contrast) instead of border-color: transparent and outline: none so
keyboard users can see focus on the TextArea component (class
.variant-borderless / TextArea component).

---

Nitpick comments:
In `@packages/raystack/components/text-area/text-area.tsx`:
- Around line 35-47: The TextArea component currently relies on an implicit
default for rows via rows={3} merged from {...props}; update the TextArea
function signature to destructure rows with an explicit default (e.g., rows = 3)
alongside other props so the default is obvious and cannot be accidentally
overridden by spread order; locate the TextArea function (export function
TextArea) and remove or adjust any later rows={3} usage so the component uses
the destructured rows value when rendering the underlying textarea.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e5091c4d-56ca-4e79-866e-8c23a668f795

📥 Commits

Reviewing files that changed from the base of the PR and between 26e02f6 and 1a1e1ed.

📒 Files selected for processing (6)
  • apps/www/src/content/docs/components/textarea/demo.ts
  • apps/www/src/content/docs/components/textarea/index.mdx
  • apps/www/src/content/docs/components/textarea/props.ts
  • packages/raystack/components/text-area/__tests__/text-area.test.tsx
  • packages/raystack/components/text-area/text-area.module.css
  • packages/raystack/components/text-area/text-area.tsx

Comment on lines +90 to +93
.variant-borderless:focus:not(:disabled) {
border-color: transparent;
outline: none;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Borderless variant loses visible keyboard focus state.

Line 90–93 keeps border transparent and removes outline, so focused and unfocused states become visually indistinguishable for keyboard users. Please retain a visible focus indicator for variant="borderless".

Suggested patch
 .variant-borderless:focus:not(:disabled) {
   border-color: transparent;
-  outline: none;
+  outline: 2px solid var(--rs-color-border-accent-emphasis);
+  outline-offset: 1px;
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/raystack/components/text-area/text-area.module.css` around lines 90
- 93, The CSS for .variant-borderless currently removes the border and outline
on focus, making keyboard focus invisible; update the focus rule for
.variant-borderless:focus:not(:disabled) to keep a visible focus indicator
(e.g., use a non-transparent border-color, box-shadow, or outline with
accessible contrast) instead of border-color: transparent and outline: none so
keyboard users can see focus on the TextArea component (class
.variant-borderless / TextArea component).

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.

[TextArea] Fix overflow, add minRows/maxRows, and align API with InputField

1 participant