Accessibility action on Flutter
Accessibility actions provide alternative ways for users of assistive technologies to perform actions. For users of switch control it can be difficult to use drag-and-drop functionality. This functionality can be made more accessible by providing accessibility actions to move items up and down.
With Flutter, you can use CustomSemanticsAction
to add custom actions for assistive technologies. To implement specific functionality for assistive technologies it is also possible to add onTap
, onLongPress
or other callbacks to the Semantics
widget. When you do this, it is important to make sure the child nodes do not implement a touch listener, or to use excludeSemantics
to ignore these with the assistive technologies.
Semantics(
customSemanticsActions: <CustomSemanticsAction, VoidCallback>{
CustomSemanticsAction(label: 'Increment'): _incrementCounter,
},
onTap: () {
_incrementCounter
},
excludeSemantics: true,
child: TextButton(...)
);