Accessibility role on Flutter
An accessibility role helps users of assistive technologies to understand the purpose of elements on the screen. The role button
for example, indicates that an action will be performed on activation. The screen reader announces the role of elements as it reads the screen. It is important to assign correct roles to elements to avoid misunderstanding.
Accessibility role - Flutter
For some widgets in Flutter, the role is assignd automatically. This happens, for example, with Flutter's buttons and text fields. If this is not the case, you can use Semantics
to indicate a role. The Semantics constructor
contains all available options, such as button
, header
, link
and image
, among others.
Semantics(
button: true,
header: true,
link: true,
image: true,
child: Widget(...)
);