Skip to content

Add accessibility semantics to gesture detector widgets #1426

@timukasr

Description

@timukasr

Use case

When HTML contains links, then they should have button (or link) semantics so screen readers announce them correctly and Voice Control has item labels. This can currently be achieved via custom factoryBuilder.

Proposal

I think this should be a standard behavior: wrapping MouseRegion with Semantics(button: true) or similar.

Widget? buildGestureDetector(
BuildTree tree,
Widget child,
GestureRecognizer recognizer,
) {
var built = child;
if (recognizer is TapGestureRecognizer) {
built = MouseRegion(
cursor: SystemMouseCursors.click,
child: GestureDetector(onTap: recognizer.onTap, child: child),
);
}
return built;
}

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions