Skip to content

Form Error Messages Announced All at Once Overwhelming VoiceOver Users. #156340

@azizChebbi

Description

@azizChebbi

Steps to reproduce

  • create a random form.
  • activate the voiceover from your mobile accessibility settings.
  • save the form without filling it or with wrong values.

Expected results

The voiceover announce only the first error message each time the user saves the form, guiding users with disabilities through each field error step-by-step.

Actual results

When validating a form in Flutter, all error messages are concatenated into a single message and announced at once. This behavior overwhelms users relying on voiceover, as they are bombarded with multiple pieces of information simultaneously.

Code sample

This is the code that actually exists in the library:

bool _validate([Set<FormFieldState<Object?>>? invalidFields]) {
    bool hasError = false;
    String errorMessage = '';
    for (final FormFieldState<dynamic> field in _fields) {
      final bool isFieldValid = field.validate();
      hasError = !isFieldValid || hasError;
      errorMessage += field.errorText ?? '';
      if (invalidFields != null && !isFieldValid) {
        invalidFields.add(field);
      }
    }

    if (errorMessage.isNotEmpty) {
      final TextDirection directionality = Directionality.of(context);
      if (defaultTargetPlatform == TargetPlatform.iOS) {
        unawaited(Future<void>(() async {
          await Future<void>.delayed(_kIOSAnnouncementDelayDuration);
          SemanticsService.announce(errorMessage, directionality,
              assertiveness: Assertiveness.assertive);
        }));
      } else {
        SemanticsService.announce(errorMessage, directionality,
            assertiveness: Assertiveness.assertive);
      }
    }
    return !hasError;
  }

Screenshots or Video

before.mp4

Logs

No response

Flutter Doctor output

not related.

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work lista: accessibilityAccessibility, e.g. VoiceOver or TalkBack. (aka a11y)found in release: 3.24Found to occur in 3.24found in release: 3.26Found to occur in 3.26frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionteam-accessibilityOwned by Framework Accessibility team (i.e. responsible for accessibility code in flutter/flutter)triaged-accessibilityTriaged by Framework Accessibility team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions