diff --git a/packages/flutter/lib/src/cupertino/text_field.dart b/packages/flutter/lib/src/cupertino/text_field.dart index 73d3cce5f0a..a8bc08b1c8d 100644 --- a/packages/flutter/lib/src/cupertino/text_field.dart +++ b/packages/flutter/lib/src/cupertino/text_field.dart @@ -200,6 +200,8 @@ class CupertinoTextField extends StatefulWidget { /// [enableSuggestions], and [enableIMEPersonalizedLearning] properties must /// not be null. /// + /// {@macro flutter.widgets.editableText.accessibility} + /// /// See also: /// /// * [minLines], which is the minimum number of lines to occupy when the diff --git a/packages/flutter/lib/src/material/text_field.dart b/packages/flutter/lib/src/material/text_field.dart index c7caa46b072..0bf3addeb3d 100644 --- a/packages/flutter/lib/src/material/text_field.dart +++ b/packages/flutter/lib/src/material/text_field.dart @@ -207,6 +207,8 @@ class _TextFieldSelectionGestureDetectorBuilder extends TextSelectionGestureDete /// /// {@macro flutter.widgets.editableText.showCaretOnScreen} /// +/// {@macro flutter.widgets.editableText.accessibility} +/// /// See also: /// /// * [TextFormField], which integrates with the [Form] widget. diff --git a/packages/flutter/lib/src/widgets/editable_text.dart b/packages/flutter/lib/src/widgets/editable_text.dart index f1e992e3225..5eb767eb538 100644 --- a/packages/flutter/lib/src/widgets/editable_text.dart +++ b/packages/flutter/lib/src/widgets/editable_text.dart @@ -437,6 +437,30 @@ class ToolbarOptions { /// * When the virtual keyboard pops up. /// {@endtemplate} /// +/// {@template flutter.widgets.editableText.accessibility} +/// ## Troubleshooting Common Accessibility Issues +/// +/// ### Customizing User Input Accessibility Announcements +/// +/// To customize user input accessibility announcements triggered by text +/// changes, use [SemanticsService.announce] to make the desired +/// accessibility announcement. +/// +/// On iOS, the on-screen keyboard may announce the most recent input +/// incorrectly when a [TextInputFormatter] inserts a thousands separator to +/// a currency value text field. The following example demonstrates how to +/// suppress the default accessibility announcements by always announcing +/// the content of the text field as a US currency value: +/// ```dart +/// onChanged: (String newText) { +/// if (newText.isNotEmpty) { +/// SemanticsService.announce('\$' + newText, Directionality.of(context)); +/// } +/// } +/// ``` +/// +/// {@endtemplate} +/// /// See also: /// /// * [TextField], which is a full-featured, material-design text input field