Rating component on swipe gesture reads the ariaLabelFormat text but does not change fill color while on right-left arrow it does
Environment Information
- Package version(s): ^7.150.0
- Browser and OS versions: Chrome and Android + Windows
Describe the issue:
Rating component is used in one of our UI page which is used both for Android and Web versions. For Android, the page is displayed under the app as a webview.
For Web version on Edge:
- With narrator on and moving across star ratings using CapsLock + right/left arrow keys, the star icon gets filled. The narrator is able to announce the text referred in ariaLabelFormat.
For Android:
- With Accessibility on and moving across star ratings using swipe left/right, the focus does shift accordingly. The narrator is able to announce the text referred in ariaLabelFormat but the star icon does not change its fill state.
We can replicate the same behavior on a touch-based laptop and Edge (Chromium based browsers) as it is possible to simulate touch gestures in Chromium based browsers. Reference: https://stackoverflow.com/questions/36877041/how-to-simulate-touch-gestures-in-browser-preferably-chrome
Please provide a reproduction of the issue in a codepen:
https://codepen.io/dipgupta-msft/pen/bGwbBKd
Actual behavior:
On swipe gesture, the star icon does not get filled but narrator announces the ariaLabelFormat giving a notion that the star is selected.
Screenshot for Web:

Screenshot simulating swipe gesture:

Expected behavior:
On Swipe gesture, the star icon should also get filled to be in line with what narrator is announcing as read by ariaLabelFormat.
@dipgupta-msft thanks for filing this. Just so I understand correctly, is the issue that when navigating by keyboard the stars get filled in as navigation occurs, however, when navigating with just the screen reader the stars are not filled in?
If so I'm not sure this is fixable, I don't think we can or should have the UI respond to screen reader navigation, the main purpose there is that the screen reader can read the screen without changing it. This would be the same as using scan or browse mode in a desktop screen reader.
@JustSlone : Thank you for taking up this issue for discussion. From the behavior point of view and touch-based devices (like Android) what is happening is:
- When we have talkback on, the way we move across components is by a right-swipe.
- When we are on the rating component, if we do a 'right-swipe', the narrator is able to announce "Selected 2 of 5 stars" (in case the you have swiped two times and there are in total 5 stars).
- But the fill-color still does not change. It is only when we double-tap on it (because the talkback is on) we are able to see the icons getting filled.
To my understanding, the behavior is not analogous to keyboard navigation where on using right-left arrow keys, the icon fill color does change.
Yep, I agree that the behavior while swiping on talkback is not the same as keyboard and that the stars should not fill (actually I don't think we could even respond to talkback focus on the element).
Actually really this behavior seems similar to how Narrator/NVDA operate in scan/browse mode where the screen reader moves around the screen and does not cause any focus events. It seems like the swiping in Talkback/VoiceOver is similar to this mode.
See this gif for how NVDA behaves in browse mode.

As for the misleading announce. It's actually announcing "Select 2 of 5 stars" to let the user know that this button will allow them to Select 2 of the 5 stars. It seems like that's a reasonable announce?
The core problem here is the
I would recommend representing the star buttons as (i.e. radio buttons) since the semantics match the best. Radio buttons implicitly have a selected state and furthermore, only one in a set can be selected at a time. See http://petewu-dev/StarRatings.1.htm for a prototype of how you can implement a star ratings control using radio buttons. When you Arrow Key to a star, Narrator announces "[Name], [Role], [Value], [Position in List]" or "3 stars, Radio Button, Selected, 3 of 5". When you item-navigate (i.e. swipe right or Caps+Right Arrow) to a star, you place the focus on it without selecting it, so Narrator will announce "4 stars, Radio Button, Nonselected, 4 of 5". When you invoke it (i.e. double tap or Caps+Enter), Narrator announces the new value, i.e. "Selected".
Note: the position in list is exposed in the aria-posinset and aria-setsize attributes. Narrator announces the "N of M" position in list at verbosity level 3 or higher. It is better to expose the information this way than to incorporate "N of M" into the Name.
Please take a look at exposing the selected state for the button properly to make the star rating control accessible. Without, screen reader users won't be able to know whether or not they have selected the star especially when using touch navigation.
To learn more about how to make custom controls such as this accessible, see https://aka.ms/AccessibilityDemystified.
Interesting idea around using radio group to implement this. I'm not sure about the reading of "radio button" for each star, it seems redundant, but reading the checked/not checked state seems to be an improvement.
This could be something we look at when we refresh the rating component, it's too big for us to take on right now. @petewu100 if you are interested in contributing to rating to make it better, we could setup some reviews of this method to make sure it would work, then review the change. It would have to be for the next major release though, as this would certainly be a breaking change to the ratings component.
Here's a Gif of the prototype with NVDA for the sake of others.

Thank you for taking a look at the radio button approach, JustSloan.
In the near term, a small change you could make to improve the experience is to add aria-pressed to each
Radio buttons is the better solution longer term, but toggle buttons should be a small change they can be done in the meantime.
Thank you.
@petewu100 that seems like a reasonable short term fix, as long as it doesn't negative affect the screen reader experience for existing users of the rating component. If you or @dipgupta-msft are interested in a spinning up a PR with this change I can find someone to review it.
Note, folks will be out for the holidays soon, so it might not get reviewed until January.
:tada:This issue was addressed in #17267, which has now been successfully released as @fluentui/[email protected].:tada:
Handy links:
:tada:This issue was addressed in #17267, which has now been successfully released as @fluentui/[email protected].:tada:
Handy links:
:tada:This issue was addressed in #17267, which has now been successfully released as @fluentui/[email protected].:tada:
Handy links:
:tada:This issue was addressed in #17267, which has now been successfully released as @fluentui/[email protected].:tada:
Handy links:
:tada:This issue was addressed in #17267, which has now been successfully released as @fluentui/[email protected].:tada:
Handy links:
:tada:This issue was addressed in #17267, which has now been successfully released as @fluentui/[email protected].:tada:
Handy links:
:tada:This issue was addressed in #17267, which has now been successfully released as @fluentui/[email protected].:tada:
Handy links:
:tada:This issue was addressed in #17267, which has now been successfully released as @fluentui/[email protected].:tada:
Handy links:
:tada:This issue was addressed in #17267, which has now been successfully released as @fluentui/[email protected].:tada:
Handy links:
:tada:This issue was addressed in #17267, which has now been successfully released as @fluentui/[email protected].:tada:
Handy links:
:tada:This issue was addressed in #17267, which has now been successfully released as @fluentui/[email protected].:tada:
Handy links:
:tada:This issue was addressed in #17267, which has now been successfully released as @fluentui/[email protected].:tada:
Handy links:
:tada:This issue was addressed in #17267, which has now been successfully released as @fluentui/[email protected].:tada:
Handy links: