Skip to content

fix: Reset behavior is inaccessible by keyboard in Rating Component #3069

@arazni

Description

@arazni

🐛 Bug Report

When a keyboard only user (often a blind person) interacts with the Rating component, they are unable to use the Reset functionality.

💻 Repro or Code Sample

Visit your demo page

Change the component to Allow Reset (true).

Navigate back to the rating component with tabs.

There is no key that enables the reset functionality.

🤔 Expected Behavior

There should be some button that enables you to reset the rating for a keyboard only user.

😯 Current Behavior

Hitting {enter} or {space} does not trigger a reset.

💁 Possible Solution

This is actually requires more consideration than it seems.

One frustration I found for this component in the context of my application is that tabbing into it inherently changes the state of the rating component, which I wanted to use for a non-traditional use case (to track a mutable value during a game and emulate the checkbox experience the players are used to). I plan to give up on this component for my application.

So, because the actual value of the rating component changes simply by tabbing or using arrow keys, no {enter} or {space} is necessary to set the value in the first place. However, hitting {enter} or {space} to set the value may be a reasonable habit developed based on how other inputs accept keyboard interaction.

This implies that fixing it so that hitting {enter} or {space} to trigger the reset may be confusing behavior for someone who does not yet realize that hitting {enter} or {space} is unnecessary. That would typically be the standard behavior for a radio group as well, if I understand correctly.

However, that risk may be mitigated by the fact that the screenreader reads the rating's currently navigated value as "checked", which would hopefully successfully indicate that they do not need to hit {enter} or {space} to set the value. Additionally, if hitting {enter} or {space} set it to unchecked and the screen reader correctly picks that up, the user will be informed that their action undid their selection.

It may still be the case that the best action is to make {enter} or {space} be the button to clear the selection when reset is enabled.

However, a deeper evaluation may decide that the state should not mutate by being tabbed or arrowed unless a {space} or {enter} is used to set the value in the first place. Then, a second {space} or {enter} would clear the value if it is already set.

Some research may be necessary to determine if {space} or {enter} is the more appropriate way to set the value if that route is pursued. I believe {space} is preferred in this case, but I am not an expert.

🔦 Context

My web app tries to be accessible to blind users. They will not be able to reset through this Rating component. (I do have a setting to enable them to use a slider component wherever a rating would appear, however.)

🌍 Your Environment

  • OS & Device: Windows 11 PC
  • Browser Edge and Firefox
  • .NET 9 and Fluent UI 4.11.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs: author feedbackThe author of this issue needs to respond in order for us to continue investigating this issue.status:in-progressWork is in progress

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions