From dde475de4b551dead21dd176494eb8b8e8500a6a Mon Sep 17 00:00:00 2001 From: Dennis Fokin Date: Fri, 25 Oct 2024 11:27:32 +0200 Subject: [PATCH 1/2] A11y: read title and description of promptUserInteraction --- lib/app/views/user_interaction.dart | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/app/views/user_interaction.dart b/lib/app/views/user_interaction.dart index ad590700..74f05ba6 100755 --- a/lib/app/views/user_interaction.dart +++ b/lib/app/views/user_interaction.dart @@ -17,6 +17,7 @@ import 'dart:async'; import 'package:flutter/material.dart'; +import 'package:flutter/rendering.dart'; import 'package:local_notifier/local_notifier.dart'; import '../message.dart'; @@ -139,6 +140,8 @@ UserInteractionController promptUserInteraction( void Function()? onCancel, bool headless = false, }) { + String a11yLabel = title + description; + SemanticsService.announce(a11yLabel, TextDirection.ltr); if (headless) { // No support for icon or onCancel. return _notificationUserInteraction(context, From 177c0523087abf06b0627314b7924ab8a0f907e7 Mon Sep 17 00:00:00 2001 From: Dennis Fokin Date: Fri, 25 Oct 2024 13:48:24 +0200 Subject: [PATCH 2/2] No need for SemanticsService.announce() when headless --- lib/app/views/user_interaction.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/app/views/user_interaction.dart b/lib/app/views/user_interaction.dart index 74f05ba6..f95f4180 100755 --- a/lib/app/views/user_interaction.dart +++ b/lib/app/views/user_interaction.dart @@ -140,8 +140,6 @@ UserInteractionController promptUserInteraction( void Function()? onCancel, bool headless = false, }) { - String a11yLabel = title + description; - SemanticsService.announce(a11yLabel, TextDirection.ltr); if (headless) { // No support for icon or onCancel. return _notificationUserInteraction(context, @@ -159,6 +157,8 @@ UserInteractionController _dialogUserInteraction( Widget? icon, void Function()? onCancel, }) { + String a11yLabel = '$title $description'; + SemanticsService.announce(a11yLabel, TextDirection.ltr); var completed = false; var wasPopped = false; final controller = _UserInteractionController(