From bed111a165ede30e4575ad7e21993a634c86a229 Mon Sep 17 00:00:00 2001 From: Thibault Deckers Date: Fri, 3 Mar 2023 18:17:51 +0100 Subject: [PATCH] accessibility: disable accessibility nav in app media query --- CHANGELOG.md | 1 + lib/widgets/about/bug_report.dart | 2 +- lib/widgets/aves_app.dart | 49 ++++++++++++++++++++----------- 3 files changed, 34 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 04954e13c..ede6aa10c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file. ### Fixed +- Accessibility: using accessibility services keeping snack bar beyond countdown - Accessibility: navigation with TalkBack ## [v1.8.2] - 2023-02-28 diff --git a/lib/widgets/about/bug_report.dart b/lib/widgets/about/bug_report.dart index 3506dad8c..390e49b0b 100644 --- a/lib/widgets/about/bug_report.dart +++ b/lib/widgets/about/bug_report.dart @@ -161,7 +161,7 @@ class _BugReportState extends State with FeedbackMixin { 'System locales: ${WidgetsBinding.instance.window.locales.join(', ')}', 'Aves locale: ${settings.locale ?? 'system'} -> ${settings.appliedLocale}', 'Installer: ${packageInfo.installerStore}', - 'Accessibility: accessibleNavigation=${accessibility.accessibleNavigation}, disableAnimations=${accessibility.disableAnimations}', + 'Error reporting: ${settings.isErrorReportingAllowed}', ].join('\n'); } diff --git a/lib/widgets/aves_app.dart b/lib/widgets/aves_app.dart index 211f883e2..6e1b3dfdf 100644 --- a/lib/widgets/aves_app.dart +++ b/lib/widgets/aves_app.dart @@ -247,24 +247,39 @@ class _AvesAppState extends State with WidgetsBindingObserver { // handle Android TV remote `select` button LogicalKeySet(LogicalKeyboardKey.select): const ActivateIntent(), }, - child: MaterialApp( - navigatorKey: AvesApp.navigatorKey, - home: home, - navigatorObservers: _navigatorObservers, - builder: (context, child) => _decorateAppChild( - context: context, - initialized: initialized, - child: child, + child: MediaQuery.fromWindow( + child: Builder( + builder: (context) { + return MediaQuery( + data: MediaQuery.of(context).copyWith( + // disable accessible navigation, as it impacts snack bar action timer + // for all users of apps registered as accessibility services, + // even though they are not for accessibility purposes (like TalkBack is) + accessibleNavigation: false, + ), + child: MaterialApp( + navigatorKey: AvesApp.navigatorKey, + home: home, + navigatorObservers: _navigatorObservers, + builder: (context, child) => _decorateAppChild( + context: context, + initialized: initialized, + child: child, + ), + onGenerateTitle: (context) => context.l10n.appName, + theme: lightTheme, + darkTheme: darkTheme, + themeMode: themeBrightness.appThemeMode, + locale: settingsLocale, + localizationsDelegates: AppLocalizations.localizationsDelegates, + supportedLocales: AvesApp.supportedLocales, + // TODO TLAD remove custom scroll behavior when this is fixed: https://github.com/flutter/flutter/issues/82906 + scrollBehavior: StretchMaterialScrollBehavior(), + useInheritedMediaQuery: true, + ), + ); + }, ), - onGenerateTitle: (context) => context.l10n.appName, - theme: lightTheme, - darkTheme: darkTheme, - themeMode: themeBrightness.appThemeMode, - locale: settingsLocale, - localizationsDelegates: AppLocalizations.localizationsDelegates, - supportedLocales: AvesApp.supportedLocales, - // TODO TLAD remove custom scroll behavior when this is fixed: https://github.com/flutter/flutter/issues/82906 - scrollBehavior: StretchMaterialScrollBehavior(), ), ); },