Skip to content

Conversation

@llfalcao
Copy link
Contributor

@llfalcao llfalcao commented Oct 24, 2025

What's the purpose of this pull request?

  • Fixes an issue where screen readers wouldn't announce the value text provided by the prop getAriaValueText.
  • Adds the missing disabled prop to both inputs.

How it works?

Currently, screen readers announce the elements's role (e.g. "horizontal slider", or "slider at") and then the input value. The prop getAriaValueText was supposed to allow a human-readable text containing the current value to be announced instead. However, it was assigned to the aria-labelledby prop instead of aria-valuetext. aria-labelledby should only be used to reference other elements (via ids) that will act as labels, instead of receiving formatted texts for the input values.

After the fix, screen readers should announce the slider's role and then the formatted text provided by the function getAriaValueText.

How to test it?

Aria Attributes

  • Follow the Local Install Instructions from the CodeSandbox CI to update the package.json of a store;
  • Import the Slider atom in a component following the docs: https://developers.vtex.com/docs/guides/faststore/atoms-slider
  • Assign a function to the getAriaValueText prop that returns a custom value text;
  • Enable your operating system's screen reader;
  • Open the store in development mode;
  • Click or move slider thumbs and verify that the screen reader announces your custom value text.

Disabled Attribute

  • Pass the disabled prop to the Slider atom;
  • Verify that the slider interaction is disabled.

References

MDN - aria-labelledby

@llfalcao llfalcao marked this pull request as ready for review October 24, 2025 19:14
@llfalcao llfalcao requested a review from a team as a code owner October 24, 2025 19:14
@llfalcao llfalcao requested review from emersonlaurentino and hellofanny and removed request for a team October 24, 2025 19:14
@codesandbox-ci
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@matheusps matheusps changed the base branch from main to dev October 27, 2025 16:04
@llfalcao llfalcao changed the title fix(slider): use aria-valuetext and disabled attributes fix(ui): use aria-valuetext and disabled attributes Nov 7, 2025
@llfalcao
Copy link
Contributor Author

llfalcao commented Nov 7, 2025

Updated PR title (slider -> ui).

@llfalcao llfalcao changed the title fix(ui): use aria-valuetext and disabled attributes fix(ui): use aria-valuetext and disabled attributes on Slider Nov 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant