Feat: Add a11y for loading indicators#165173
Conversation
a4da150 to
f6e5619
Compare
| static const int _kHasRequiredStateIndex = 1 << 29; | ||
| static const int _kIsRequiredIndex = 1 << 30; | ||
| static const int _kIsProgressBarIndex = 1 << 31; | ||
| static const int _kIsLoadingSpinnerIndex = 1 << 32; |
There was a problem hiding this comment.
This flag can at most fit 32 bit, so this is likely not going to work for platform that uses 32 bit int.
Also we already have progress bar and loadingspinner in https://main-api.flutter.dev/flutter/dart-ui/SemanticsRole.html
you can directly use that.
However these 2 enums are currently not wired up engine, so we will need to update the engine still
There was a problem hiding this comment.
actually do we need these flags in this pr? it looks like they are not used
There was a problem hiding this comment.
Sure, I can remove these.
| semanticsObject, | ||
| preferredLabelRepresentation: LabelRepresentation.ariaLabel, | ||
| ) { | ||
| setAriaRole('loadingSpinner'); |
There was a problem hiding this comment.
there is no loading spiner role in web
There was a problem hiding this comment.
Sure, I will remove this.
engine/src/flutter/lib/web_ui/lib/src/engine/semantics/progress_bar.dart
Show resolved
Hide resolved
| return _buildIndicator(context, _controller.value, textDirection); | ||
| }, | ||
| return Semantics( | ||
| role: SemanticsRole.loadingSpinner, |
There was a problem hiding this comment.
this is not a spinner, right?
There was a problem hiding this comment.
It is. Because if value is not given, it will be in loading mode else it will be in progreessbar mode.
| enabled: widget.value != null, | ||
| role: SemanticsRole.progressBar, | ||
| child: Semantics( | ||
| enabled: widget.value == null, |
There was a problem hiding this comment.
we should probably only assign progressbar or loadingspinner but not both
There was a problem hiding this comment.
At a time, it only assign one.
Because if value is not given its loadingSpinner else its progressBar.
f6e5619 to
0034f92
Compare
|
Is this PR ready for another round of review? (from triage) |
0034f92 to
b7a864f
Compare
Yes @dkwingsmt. |
| } | ||
| } | ||
| return Semantics( | ||
| value: widget.value != null ? '${(widget.value ?? 0) * 100}%' : null, |
There was a problem hiding this comment.
| value: widget.value != null ? '${(widget.value ?? 0) * 100}%' : null, | |
| value: widget.value != null ? '${widget.value! * 100}%' : null, |
There was a problem hiding this comment.
also should it have the % after the number?
There was a problem hiding this comment.
I have removed this.
| setAriaRole('progressbar'); | ||
|
|
||
| // Progress indicators in Flutter use values between 0.0 and 1.0 | ||
| setAttribute('aria-valuemin', "0"); |
There was a problem hiding this comment.
we may need a a new property for maxValue and minValue to propergate the value range. Hardcoded to 0 and 100 may be too opinionated
There was a problem hiding this comment.
Add new properties maxValue and minValue.
b7a864f to
3f35fa6
Compare
d61aae5 to
050ace5
Compare
050ace5 to
cf1d583
Compare
cf1d583 to
99965e8
Compare
c0881c1 to
4661a35
Compare
|
@chunhtai I checked the tests, but couldn't figure out issue. Can you please help me with this? |
|
This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
|
Hey @rkishan516 it looks like you made some updates here, but there are some failing tests. Do you plan to continue with this change? |
Yes, this is around the corner for landing, just few tests are failing. Will give a try over weekend. |
|
@chunhtai, @hannah-hyj can you do a last review? all tests are fixed now. |
|
Gentle nudge @chunhtai (from triage) |
|
autosubmit label was removed for flutter/flutter/165173, because - The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label. |
|
the google test is a valid failure, but the actual bug is in tab widget. will have to fix it before merging this i will put up a pr to fix the tab first, then we can merge this pr after that |
|
It looks like there are some merge conflicts here, but once those are sorted I think the blocking issue has been resolved here. |
|
Reason for revert: The PR did not finish "Google Testing", and actually caused several failures in Google |
|
@rkishan516 please do not manually put PRs in the queue, the |
Sure, I will keep in mind. |
Feat: Add a11y for loading indicators
fixes: #161631
Pre-launch Checklist
///).