Skip to content

feat(text-area): add ariaLabel prop to TextArea and TextAreaField - #1795

Open
alexcpn wants to merge 1 commit into
dhis2:masterfrom
alexcpn:LIBS-851/textarea-aria-label
Open

alexcpn wants to merge 1 commit into
dhis2:masterfrom
alexcpn:LIBS-851/textarea-aria-label

Conversation

@alexcpn

@alexcpn alexcpn commented Nov 26, 2026 •

Copy link
Copy Markdown

Implements LIBS-851


Description

Input accepts an ariaLabel prop and renders it as aria-label on the <input>. TextArea had no equivalent, so a textarea without a visible <label> had no accessible name (WCAG 4.1.2).

This PR:

  • adds an ariaLabel prop to TextArea and renders it as aria-label on the <textarea>
  • adds ariaLabel to TextAreaField and forwards it to TextArea
  • adds the prop to types/index.d.ts and regenerates API.md

When the prop isn't set, nothing is rendered (aria-label is omitted), so existing usage is unchanged.

Not in this PR: the ticket also asks for TextAreaField to wire aria-describedby to its help/validation text "matching InputField behaviour". On master, InputField doesn't do that (and doesn't forward ariaLabel either), so there's no existing pattern to match. That would be a Field-level change that affects every field component, and I think it deserves its own ticket/PR. I'm happy to do it if you agree on the approach.

How it was tested

  • New tests for TextArea and TextAreaField: with ariaLabel, the textbox is found by its accessible name and has the attribute; without it, there is no aria-label. The ariaLabel tests fail on master and pass with this change.
  • All text-area tests pass (6). eslint and prettier --check are clean.
  • API.md was regenerated with scripts/generate-api-docs.js. The only diff is the new ariaLabel rows.

Known issues

  • Cypress feature tests were not run locally.

Checklist

  • API docs are generated
  • Tests were added
  • Storybook demos were added

No Storybook demo was added: the prop has no visual effect.


AI disclosure

This change was written and tested by an AI model, Claude Opus 5.5 (via Claude Code), and submitted by a human contributor.

#T4G (tokens for good project)

🤖 Generated with Claude Code

@alexcpn
alexcpn requested a review from a team as a code owner November 26, 2026 14:10
TextArea had no way to set aria-label on its textarea, so a textarea
without a visible label had no accessible name. Add an ariaLabel prop,
matching Input, and forward it from TextAreaField.

Implements LIBS-851

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@alexcpn
alexcpn force-pushed the LIBS-851/textarea-aria-label branch from 2106bda to 84a56cc Compare December 4, 2026 13:44
@sonarqubecloud

sonarqubecloud Bot commented Dec 4, 2026

Copy link
Copy Markdown

This branch has not been deployed

No deployments
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