Skip to content

A11Y issue - MaterialPinField/PinInput: semanticHint is hardcoded and cannot be overridden #424

@epentesi

Description

@epentesi

Summary

PinInput (and by extension MaterialPinField) exposes a semanticLabel parameter that allows consumers to customize the accessibility label announced by screen readers. However, the semanticHint is hardcoded inside _PinInputState.build() and there is no way to override it.

Current behaviour

The hint is always computed as:

final semanticHint = filledCount < widget.length
    ? 'Enter ${widget.length - filledCount} more ${widget.length - filledCount == 1 ? 'digit' : 'digits'}'
    : 'PIN complete';

This string is English-only and cannot be replaced, so apps that:

  • support multiple languages / localisation,
  • use a custom terminology (e.g. "characters" instead of "digits"),
  • or simply want to provide context-specific guidance,

have no way to customize the accessibility hint without forking the package.

Expected behavior

A semanticHint parameter (or a semanticHintBuilder) should be available on both PinInput and MaterialPinField, consistent with how semanticLabel is already handled.

Additional context

semanticLabel is already overridable in both widgets (see material_pin_field.dart line 81 and pin_input.dart line 97), so this change would simply extend the same pattern to semanticHint.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions