Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Modify dataMap to include assertiveness only if it's not set to polite #108396

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 27, 2022

Conversation

nbayati
Copy link
Contributor

@nbayati nbayati commented Jul 26, 2022

Add an optional flag to Flutter's accessibility announcer service to support two different modes of aria announcements in flutter web. Developers can make the announcement assertive or polite using this flag. The change on the web engine side is tracked here: flutter/engine#34640

The first PR was breaking some of the Google tests and had to get reverted. The tests were breaking because they were receiving an additional piece of information (assertiveness) in the dataMap string. In this fix, we don't include assertiveness if it has the default value of polite.

Fixes #104109

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@nbayati nbayati requested review from yjbanov and goderbauer July 26, 2022 22:48
@flutter-dashboard flutter-dashboard bot added a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) framework flutter/packages/flutter repository. See also f: labels. labels Jul 26, 2022
@nbayati nbayati changed the title Modify dataMap to include assertiveness only if it's not set to polit… Modify dataMap to include assertiveness only if it's not set to polite Jul 26, 2022
'message': message,
'textDirection': textDirection.index,
};

if (assertiveness == Assertiveness.assertive) {
dataMap['assertiveness']=assertiveness.index;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: add spaces around =.

'message': message,
'textDirection': textDirection.index,
};

if (assertiveness == Assertiveness.assertive) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'message': message,
'textDirection': textDirection.index,
};

if (assertiveness == Assertiveness.assertive) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, this is a pretty strange design. Can we just fix up the failing tests in google?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is accompanied by an engine change as well, so my recommendation is to avoid touching too many repositories at once, which is achieved by making it non-breaking.

Having said that, fixing downstream tests sounds like a good idea. We can do it in multiple phases. Phase one - this change - introduce the API in a non-breaking fashion and stabilize it. Phase two - update tests to accept assertiveness: 0. Phase three - remove the condition.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be very clear: I don't think it is great practice that this was submitted while we were still discussing the best course forward. There should have at the very least been a TODO left here to remind future readers why we are (temporarily) doing this weirdness. Also, please clean this up ASAP once this has rolled into google.

Copy link
Contributor

@yjbanov yjbanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

'message': message,
'textDirection': textDirection.index,
};

if (assertiveness == Assertiveness.assertive) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is accompanied by an engine change as well, so my recommendation is to avoid touching too many repositories at once, which is achieved by making it non-breaking.

Having said that, fixing downstream tests sounds like a good idea. We can do it in multiple phases. Phase one - this change - introduce the API in a non-breaking fashion and stabilize it. Phase two - update tests to accept assertiveness: 0. Phase three - remove the condition.

@nbayati nbayati merged commit b5a36f0 into flutter:master Jul 27, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 27, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Jul 28, 2022
camsim99 pushed a commit to camsim99/flutter that referenced this pull request Aug 10, 2022
flutter#108396)

* Modify dataMap to include assertiveness only if it's not set to polite to prevent google3 tests from breaking

* small code style enhancement
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using aria-live="assertive" for Flutter-web's SemanticsService.announce implementation
3 participants