Skip to content

TextArea: add disabled styles#77129

Open
oandregal wants to merge 2 commits intotrunkfrom
fix/disabled-styles-textarea
Open

TextArea: add disabled styles#77129
oandregal wants to merge 2 commits intotrunkfrom
fix/disabled-styles-textarea

Conversation

@oandregal
Copy link
Copy Markdown
Member

Follow-up to #77090

What?

Add disabled styles to the TextareaControl component.

Why?

The TextareaControl component can be disabled via the disabled HTML attribute, but it had no visual disabled styles — the textarea looks identical whether enabled or disabled. This is inconsistent with other form controls like InputControl and RadioControl (fixed in #77127), which already have distinct disabled appearances.

Control with disabled state in story:

Before After
Screenshot 2026-04-08 at 10 38 46 Screenshot 2026-04-08 at 10 38 29

Control with disabled state in DataForm story:

Before After
Screenshot 2026-04-08 at 10 37 49 Screenshot 2026-04-08 at 10 37 55

How?

  • Added &:disabled CSS styles to StyledTextarea using the same semantic design tokens as InputControl: backgroundDisabled, borderDisabled, textDisabled, and opacity: 1 to prevent browser default dimming.
  • Added an explicit disabled prop to TextareaControlProps with JSDoc documentation.
  • Added a disabled boolean control to the Storybook story for testing.
  • Updated the CHANGELOG (and resolved pre-existing merge conflict markers).

Testing Instructions

The control's story:

  1. Open Storybook and navigate to Components / Selection & Input / Common / TextareaControl.
  2. Toggle the disabled control on.
  3. Verify the textarea has a light gray background, muted border, and grayed-out text — matching the disabled appearance of InputControl.
  4. Toggle disabled off and verify the textarea returns to its normal appearance.

DataForm's story:

  1. Open Storybook and navigate to **DataViews / DataForm / Layout Regular **.
  2. Toggle the disabled control on.
  3. Verify the textarea has a light gray background, muted border, and grayed-out text — matching the disabled appearance of InputControl.
  4. Toggle disabled off and verify the textarea returns to its normal appearance.

Use of AI Tools

Claude Code was used to assist with implementation and to generate this PR summary.

Copilot AI review requested due to automatic review settings April 8, 2026 08:42
@oandregal oandregal requested review from a team and ajitbohra as code owners April 8, 2026 08:42
@github-actions github-actions bot added the [Package] Components /packages/components label Apr 8, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 8, 2026

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: oandregal <oandregal@git.wordpress.org>
Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

- `TextareaControl`: Add disabled styles. [#77129](https://github.com/WordPress/gutenberg/pull/77129)
- `Autocomplete`: Fix value comparison to avoid resetting block inserter in RTC ([#76980](https://github.com/WordPress/gutenberg/pull/76980)).
- `ValidatedRangeControl`: Fix `aria-label` rendered as `[object Object]` when `required` or `markWhenOptional` is set ([#77042](https://github.com/WordPress/gutenberg/pull/77042)).
- `Autocomplete`: Fix matching logic to prefer longest overlapping trigger ([#77018](https://github.com/WordPress/gutenberg/pull/77018)).
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

These git conflict markers were introduced at https://github.com/WordPress/gutenberg/pull/76980/changes#r3050030572. We can just remove them, without making any other changes.

@oandregal oandregal added the [Type] Bug An existing feature does not function as intended label Apr 8, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves visual consistency of @wordpress/components form controls by adding explicit disabled styling support for TextareaControl, aligning it with other controls (e.g., InputControl).

Changes:

  • Added :disabled styling to StyledTextarea using semantic UI tokens and opacity: 1 to avoid browser-default dimming.
  • Added an explicit disabled?: boolean prop (with JSDoc) to TextareaControlProps.
  • Added a disabled boolean control to the TextareaControl Storybook story and recorded the change in the components changelog (also removing prior conflict markers).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
packages/components/src/textarea-control/types.ts Documents disabled on the public props type.
packages/components/src/textarea-control/styles/textarea-control-styles.ts Adds disabled visual styling to the textarea element.
packages/components/src/textarea-control/stories/index.story.tsx Adds a Storybook disabled control to validate the new state visually.
packages/components/CHANGELOG.md Adds an Unreleased changelog entry for the fix and removes conflict markers.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +15 to +20
/**
* Whether the textarea should be disabled.
*
* @default false
*/
disabled?: boolean;
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

TextareaControl has a dedicated README with a manual “Props” list, but the newly introduced disabled prop isn’t documented there. Please update packages/components/src/textarea-control/README.md to include disabled (type, default, and behavior) so the docs stay in sync with the exported types and Storybook controls.

Copilot uses AI. Check for mistakes.
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.

That's a good point

background: ${ COLORS.ui.backgroundDisabled };
border-color: ${ COLORS.ui.borderDisabled };
color: ${ COLORS.ui.textDisabled };
opacity: 1;
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.

Why do we need the opacity here?


&:disabled {
background: ${ COLORS.ui.backgroundDisabled };
border-color: ${ COLORS.ui.borderDisabled };
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.

Do we need to have a way if there are already borders? It seem this var is only used by input control only if is not isBorderless though. On the other hand I think setting a border-color without having a border type is a no-op, but I'm not 100% sure.

@oandregal
Copy link
Copy Markdown
Member Author

There's this conversation about whether we go this route or another that's important to figure out for this PR to land: #77127 (comment)

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

Labels

[Package] Components /packages/components [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants