Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Spinbutton aria-valuenow vs native value update timing fix #33923

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

smhigley
Copy link
Contributor

Previous Behavior

The basic problem is that we use <input type="text" role="spinbutton">, which creates tension between the native input value and the spinbutton role's expectation for aria-valuenow. Some screen readers will use value, and others will use aria-valuenow. However, if we set aria-valuenow with React, the timing of the update is one cycle after the native input/change happens. The result is that some screen readers (Narrator and VoiceOver) will read the previous value instead of the new value on value changes.

I previously removed the default aria-valuetext (which is similar to valuenow for the purposes of this bug) to avoid having two separate sources of providing the value, but both VO and Narrator will not use the native value to calculate a spinbutton value, and will default to saying 0.

New Behavior

To get around the timing problem that comes with using DOM attribute updates to provide aria-valuenow, I instead updated our code to set the IDL attribute directly (i.e. el.ariaValueNow = newValue).

Testing with VoiceOver, Narrator, NVDA, and JAWS, this seems to now work as expected.

Related Issue(s)

@smhigley smhigley requested a review from a team as a code owner February 27, 2025 23:51
Copy link

Pull request demo site: URL

Copy link

github-actions bot commented Feb 28, 2025

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
react-components
react-components: entire library
1.175 MB
294.026 kB
1.175 MB
294.092 kB
291 B
66 B
react-spinbutton
SpinButton
34.965 kB
11.661 kB
35.24 kB
11.754 kB
275 B
93 B
Unchanged fixtures
Package & Exports Size (minified/GZIP)
react-components
react-components: Button, FluentProvider & webLightTheme
69.638 kB
20.24 kB
react-components
react-components: Accordion, Button, FluentProvider, Image, Menu, Popover
225.271 kB
65.211 kB
react-components
react-components: FluentProvider & webLightTheme
44.473 kB
14.597 kB
react-portal-compat
PortalCompatProvider
8.39 kB
2.64 kB
react-timepicker-compat
TimePicker
108.551 kB
36.094 kB
🤖 This report was generated against 2f14e34e3e8d4ba97a4f8d078fa6dfee750c7567

@ValentinaKozlova ValentinaKozlova self-requested a review February 28, 2025 06:35
@@ -0,0 +1,7 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @smhigley , do you know why those screenshots are removed?

@smhigley smhigley force-pushed the spinbutton-value-update branch from 6fc6550 to c77e7cb Compare February 28, 2025 17:03
@fabricteam
Copy link
Collaborator

🕵 fluentuiv9 No visual regressions between this PR and main

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.

3 participants