fluentui icon indicating copy to clipboard operation
fluentui copied to clipboard

Accessibility issue: Rating component does not work with "slider" role

Open dipgupta-msft opened this issue 5 years ago • 5 comments

Environment Information

  • Package version(s): ^7.150.0
  • Browser and OS versions: Edge/Chrome + Windows

Describe the issue:

The rating component provides us the capability of selecting a value from a given range which adheres to the definition of "role=slider" for Accessibility standards.

  • The rating component currently does not have any intrinsic role assigned within the fluent-UI component
  • With narrator on, providing role="slider" interferes with the navigation using arrow keys and can no longer be traversed using right/left arrow keys (or Caps+left/right arrow keys).
  • There are no properties supported to set the related attributes : aria-aria-valuemin, aria-valuemax, aria-valuenow, aria-valuetext, aria-orientation

Please provide a reproduction of the issue in a codepen:

https://codepen.io/dipgupta-msft/pen/wvzGYMG

Actual behavior:

slider role not supported.

Expected behavior:

slider role should be supported with related attributes aria-aria-valuemin, aria-valuemax, aria-valuenow, aria-valuetext, aria-orientation. aria-valuenow should be set as per the user selection or can be set via property methods.

Documentation describing expected behavior

dipgupta-msft avatar Dec 06 '20 21:12 dipgupta-msft

Per my comment in https://github.com/microsoft/fluentui/issues/16059, I think radio buttons is a good way to represent the star ratings control as the semantics match well. http://petewu-dev/StarRatings.1.htm is a prototype of how this can be done. The

and will use the ARIA roles group and radio respectively. Use aria-label to specify the name of each star button, and aria-posinset and aria-setsize to specify the position in the list. Radio buttons intrinsically have Arrow Key navigation and a selected state.

While role="slider" is another possibility, I think it would require more custom work. Unfortunately, the intrinsic control in HTML is difficult to style. If you don't use the intrinsic control and use

s instead, you have to write a lot of javascript to implement all of the behaviors properly.

For comparison, the star ratings control using intrinsic radio buttons requires only a small amount of CSS and javascript.

petewu100 avatar Dec 08 '20 20:12 petewu100

@dipgupta-msft Thanks for filing this issue and @petewu100 for providing more context. That's very helpful.

@smhigley FYI on what the desired model should be here.

@JustSlone / @ecraig12345 I didn't see a resolution on #16059, so how would folks like to proceed here? It seems like there is a current model in place that reads out the value of the rating component with screen readers. While it seems like it might not be ideal, does it meet expectations?

paulgildea avatar Dec 08 '20 21:12 paulgildea

I recommend using radio buttons as well. It is more semantic than a slider role. There is no need to use FocusZone because keyboard interaction comes from free, as @petewu100 mentioned. In fact, one gets lots of things for free. Interaction patterns for radio buttons are well-known. On the other hand, mobile platforms have their own interaction patterns for sliders: double tap and slide for iOS Voiceover; volume keys for Android Talkback.

Although Rating could be implemented with role="slider", it would be surprising for users. Bear in mind that not all screen reader users are completely blind.

Let me know if you need another reference implementation. We implement our Rating control as radio buttons in Power Apps.

tahoon-ms avatar Apr 06 '21 21:04 tahoon-ms

Yeah, it seems like we should look into if it's the right choice to move to the radio button role when we converge the Rating component. So, probably not soon, but eventually.

@smhigley, what is your take on using radio buttons instead of role slider for the Rating component?

JustSlone avatar Apr 09 '21 02:04 JustSlone

Because this issue has not had activity for over 180 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

msft-fluent-ui-bot avatar Feb 04 '22 22:02 msft-fluent-ui-bot