[macOS] Fix redundancy in VoiceOver announcements for groups with `IconButton`.
VoiceOver repeats same text or label property text of Semantics Widget on MacOS 12.5.1 when AXTitleInternal is called twice from accessibilityTitle and accessibilityLabel.
Demo
https://user-images.githubusercontent.com/44445638/193924691-1e74891b-4999-4fda-bde1-a69438fb2de9.mov
Before patch
- (NSString*)accessibilityLabel {
// accessibilityLabel is "a short description of the accessibility element",
// and accessibilityTitle is "the title of the accessibility element"; at
// least in Chromium, the title usually is a short description of the element,
// so it also functions as a label.
return [self AXTitleInternal];
}
- (NSString*)accessibilityTitle {
return [self AXTitleInternal];
}
Note that this particular issue can be solved by returning an empty string from accessibilityLabel like so.
- (NSString*)accessibilityLabel {
return @"";
}
Neither break the existing unit tests. The ladder is a much less complicated PR.
I'm wondering which approach we should go with.
Fixes https://github.com/flutter/flutter/issues/111094
Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities.
- [x] I read and followed the [Flutter Style Guide] and the [C++, Objective-C, Java style guides].
- [x] I listed at least one issue that this PR fixes in the description above.
- [ ] I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See [testing the engine] for instructions on writing and running engine tests.
- [ ] I updated/added relevant documentation (doc comments with
///). - [x] I signed the [CLA].
- [ ] All existing and new tests are passing.
cc @nickppbd could you check out this video and confirm that the patch fixes https://github.com/flutter/flutter/issues/111094
@a-wallen I think it is working well now except blanks between sentences when VoiceOver reads 2nd and 4th. I headed the conversation between @a-wallen and @chunhtai about chrome. I did not say about chrome browser before, but there were errors on Web. I can not say what it was exactly now, sorry. Is it right that the VoiceOver problem at Mac is related to Web? then it's getting more complicated?
@nickppbd if I understand you correctly, each screen reader caption should display the same text as the 1st and 3rd box?
@a-wallen there is nothing wrong at the video now, I think. I just thought it’s a little weird that there are carriage returns(\n) at 2nd and 4th.
I cannot answer the question (each screen reader caption should display the same text as the 1st and 3rd box?) because I don’t know well how VoiceOver is supposed to do.
But I think it pretty works well now as flutter app developer’s view, but I found another problem when I built for web at chrome browser. If you want a video about the problem, I can upload it.
I just thought it’s a little weird that there are carriage returns(\n) at 2nd and 4th.
Yes, I also agree. And, I also tried to run the flutter app in chrome on macOS to see whether the voiceover dialog matches and I couldn't move inside of the chrome window for the demo app.
I found another problem when I built for web at chrome browser. If you want a video about the problem, I can upload it.
Yes, we would love for you to upload it to this thread if you have the chance. We appreciate your support.
@a-wallen
I couldn't move inside of the chrome window for the demo app.
It was me too, but I could move inside somehow, I used ctrl+shift+option+up or down arrow randomly and mouse click.
https://youtu.be/gBEILLEia4E ( I could not upload it at GitHub because the video size is over 10MB) I just used ctrl+option+ right arrow. at 4th, I used ctrl+option+ right arrow more than 3 times at least.
@nickppbd thanks for uploading the video, I'll work on getting macos to produce the same output.
@a-wallen https://youtu.be/eE3_nPhK6l0 I tested this code for demonstrating the problem.
https://youtu.be/gBEILLEia4E, https://youtu.be/eE3_nPhK6l0 are under below condition.
flutter doctor -v [✓] Flutter (Channel stable, 3.3.4, on macOS 12.6 21G115 darwin-x64, locale en-KR) • Flutter version 3.3.4 on channel stable at /Users/csc/Documents/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision eb6d86ee27 (3 days ago), 2022-10-04 22:31:45 -0700 • Engine revision c08d7d5efc • Dart version 2.18.2 • DevTools version 2.15.0
Checking Android licenses is taking an unexpectedly long time...[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0) • Android SDK at /Users/csc/Library/Android/sdk • Platform android-31, build-tools 31.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) • All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.0.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 14A400 • CocoaPods version 1.11.3
[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.2) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
[✓] Android Studio (version 2020.3) • Android Studio at /Volumes/Big Sur/Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
[✓] VS Code (version 1.71.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.50.0
[✓] VS Code (version 1.61.2) • VS Code at /Volumes/Big Sur/Applications/Visual Studio Code.app/Contents • Flutter extension version 3.50.0
[✓] Connected device (2 available) • macOS (desktop) • macos • darwin-x64 • macOS 12.6 21G115 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 105.0.5195.125
[✓] HTTP Host Availability • All required HTTP hosts are available