Skip to content

feat: deprecate individual Text components and add default a11yRole for mobile title Text#401

Merged
haoruikun-cb merged 6 commits intocds-v9from
harryhao/cds-1127-mark-individual-text-components-as-deprecated
Feb 20, 2026
Merged

feat: deprecate individual Text components and add default a11yRole for mobile title Text#401
haoruikun-cb merged 6 commits intocds-v9from
harryhao/cds-1127-mark-individual-text-components-as-deprecated

Conversation

@haoruikun-cb
Copy link
Copy Markdown
Contributor

@haoruikun-cb haoruikun-cb commented Feb 17, 2026

What changed? Why?

  1. Marked all individual Text components as deprecated and point them to consolidated Text component.
  2. Also removed internal usgae of the deprecated Text components.
  3. Added default accessibilityRole="header" for display1–display3 and title1–title2 fonts, matching the existing behavior of the individual TextTitleX/TextDisplayX components. Consumers can still override it.

TODO in CDSv9 release notice: make a note that we are making some changes to the default a11y behavior in Text component.

Root cause (required for bugfixes)

UI changes

iOS Old iOS New
old screenshot new screenshot
Android Old Android New
old screenshot new screenshot
Web Old Web New
old screenshot new screenshot

Testing

How has it been tested?

  • Unit tests
  • Interaction tests
  • Pseudo State tests
  • Manual - Web
  • Manual - Android (Emulator / Device)
  • Manual - iOS (Emulator / Device)

Testing instructions

Illustrations/Icons Checklist

Required if this PR changes files under packages/illustrations/** or packages/icons/**

  • verified visreg changes with Terran (include link to visreg run/approval)
  • all illustration/icons names have been reviewed by Dom and/or Terran

Change management

type=routine
risk=low
impact=sev5

automerge=false

@linear
Copy link
Copy Markdown

linear bot commented Feb 17, 2026

/** @deprecated Use `Text` with `font="display1"` instead. This component will be removed in a future major release. */
export const TextDisplay1 = memo(
forwardRef<NativeText, TextDisplay1Props>(
({ accessibilityRole = 'header', font = 'display1', ...props }, ref) => (
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.

All TextDisplayX and TextTitleX elements in mobile have a default a11y role of "header". For consumers that do not override the role themselves, there's a risk of a11y regression (or at least failing some a11y tests). Can we include something in the deprecation statements?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point, let me double check and scan through if there is similar concerns elsewhere

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated the JSDoc so customers are aware of the a11y change

@haoruikun-cb haoruikun-cb changed the title feat: deprecated individual Text components feat: deprecate individual Text components and add default a11yRole for mobile title Text Feb 18, 2026
@haoruikun-cb haoruikun-cb force-pushed the harryhao/cds-1127-mark-individual-text-components-as-deprecated branch from bcdea41 to c269c8a Compare February 18, 2026 22:48
)}
{!!endLabelProp && (
<TextEndLabel color="fgMuted" testID={`${testID}-end-label`}>
<Text color="fgMuted" font={endLabelFont} testID={`${testID}-end-label`}>
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.

nit: do we want to inline this now?

Copy link
Copy Markdown
Contributor

@hcopp hcopp left a comment

Choose a reason for hiding this comment

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

Great work, just had the one nit comment.

@haoruikun-cb haoruikun-cb merged commit 2474ee0 into cds-v9 Feb 20, 2026
15 checks passed
@haoruikun-cb haoruikun-cb deleted the harryhao/cds-1127-mark-individual-text-components-as-deprecated branch February 20, 2026 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants