Skip to content

fix!: MD3 deviations for TextInput - #5228

Closed
kachmashk wants to merge 1 commit into
callstack:mainfrom
kachmashk:fix/textinput-md3-deviations
Closed

kachmashk wants to merge 1 commit into
callstack:mainfrom
kachmashk:fix/textinput-md3-deviations

Conversation

@kachmashk

Copy link
Copy Markdown
Collaborator

Fixes four TextInput deviations from MD3:

  • Indicator color: the filled variant's resting indicator uses onSurfaceVariant instead of outline. getOutlineColor takes a variant argument, and the outlined variant keeps outline.
  • Hover (web): the filled indicator turns onSurface on hover. Error and disabled still win. The outer Pressable reads hovered from its children function.
  • Supporting text and counter: both are now linked to the input.
    • Web: aria-describedby points at them, using ids from useId.
    • Native: non-error supporting text is appended to accessibilityHint. It is no longer part of aria-label.
    • Error text uses role="alert" instead of aria-live="polite".
    • Without a label, supporting text is the accessible name.
    • A consumer accessibilityHint is merged with the computed one instead of replacing it.
  • Decorative icons: a TextInput.Icon with no press handler renders a plain View + Icon. It is role="img" with a label or aria-hidden without one. It is not a button or a focus stop, and a tap still focuses the field. Icons with handlers are unchanged and need aria-label.

Breaking:

  • Handler-less icons now render a plain View and ignore rest props other than ref, testID and the label. accessibilityRole, accessibilityLabelledBy and similar props no longer apply.
  • A consumer accessibilityHint on TextInput is now merged with the computed hint (Custom, Helper) instead of replacing it. Apps that relied on replacing the hint will hear the supporting text too.

Motivation

The filled variant's colors and hover state didn't match MD3. Helper, error and counter text weren't programmatically associated with the field, so screen readers didn't read them with it. Decorative icons were focusable buttons that did nothing, which added empty stops for assistive tech.

Related issue

Takes over an older PR: fix(text-input): correct MD3 states and accessibility #5111

Test plan

iOS (VoiceOver) and Android (TalkBack)

  1. A field with a label and helper text is read as "Label, edit box, Helper". The helper text isn't read as a separate element.
  2. An error message is announced when it appears. The field is reported as invalid.
  3. Type past maxLength and check that you hear "Character limit exceeded X of Y".
  4. A field with no label uses the helper text as its name, and it isn't read twice.
  5. A decorative TextInput.Icon is skipped, or read as an image if it has aria-label. Tapping it focuses the field.
  6. An icon with onPress is a button with its label. In a disabled field, it is announced as disabled.

Web (browser plus screen reader or the accessibility inspector)

  1. The input has aria-describedby pointing at the helper text and the counter. Each field gets unique ids, so check with two fields on one page.
  2. An error message uses role="alert".
  3. Hover over the filled variant:
    • The indicator turns onSurface.
    • It stays on the error color when the field has an error.
    • It stays on the disabled color when the field is disabled.
    • The outlined variant has no hover change.
  4. Tab through the field. Decorative icons are not focus stops.

@kachmashk kachmashk self-assigned this Nov 17, 2026
@github-actions

Copy link
Copy Markdown

Found potential problems with the pull request:

  • The description is too long. Please keep it under 1000 characters.
  • Screenshot or video evidence is missing. Make sure to include one if it affects the UI.

@kachmashk
kachmashk force-pushed the fix/textinput-md3-deviations branch from 83b28b6 to d781bd1 Compare November 17, 2026 11:26
@Doberjohn

Copy link
Copy Markdown
Collaborator

Closing in favour of #5111, which was picked up again today.

@Doberjohn Doberjohn closed this Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants