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

[SR] Add aria-hidden to individual components of interactive graph elements #2277

Merged
merged 3 commits into from
Mar 6, 2025

Conversation

nishasy
Copy link
Contributor

@nishasy nishasy commented Mar 4, 2025

Summary:

When using Safari + VoiceOver, the screen reader reads out every single internal part of every single element on the graph. For example, the arrow on a line is read out as "image" as well as the segment composing the line. This means that when traversing the graph in Safari, there are a whole bunch of empty "image"s being read out with no context. The context is provided by specific element's aria labels.

To remedy this, I added aria-hidden to all the visual elements that should not be read as "image" in all the graph types.

Issue: none

Test Plan:

Storybook

@nishasy nishasy self-assigned this Mar 4, 2025
Copy link
Contributor

github-actions bot commented Mar 4, 2025

Size Change: +313 B (+0.04%)

Total Size: 873 kB

Filename Size Change
packages/perseus/dist/es/index.js 368 kB +313 B (+0.09%)
ℹ️ View Unchanged
Filename Size
packages/kas/dist/es/index.js 39.7 kB
packages/keypad-context/dist/es/index.js 760 B
packages/kmath/dist/es/index.js 11.1 kB
packages/math-input/dist/es/index.js 78.2 kB
packages/math-input/dist/es/strings.js 1.79 kB
packages/perseus-core/dist/es/index.js 29.9 kB
packages/perseus-editor/dist/es/index.js 276 kB
packages/perseus-linter/dist/es/index.js 22.8 kB
packages/perseus-score/dist/es/index.js 20.6 kB
packages/perseus/dist/es/strings.js 6.74 kB
packages/pure-markdown/dist/es/index.js 4.14 kB
packages/simple-markdown/dist/es/index.js 13.1 kB

compressed-size-action

Copy link
Contributor

github-actions bot commented Mar 4, 2025

npm Snapshot: Published

Good news!! We've packaged up the latest commit from this PR (68eb743) and published it to npm. You
can install it using the tag PR2277.

Example:

pnpm add @khanacademy/perseus@PR2277

If you are working in Khan Academy's webapp, you can run:

./dev/tools/bump_perseus_version.sh -t PR2277

@nishasy nishasy marked this pull request as ready for review March 4, 2025 21:57
@nishasy nishasy changed the title Add aria-hidden to individual components of interactive graph elements [SR] Add aria-hidden to individual components of interactive graph elements Mar 4, 2025
@catandthemachines
Copy link
Member

Does this have any adverse effects on other screen readers? I know this is pretty bad on Safari, but I want to make sure we're not over correcting for issues that should be logged against Safari/VoiceOver.

@nishasy
Copy link
Contributor Author

nishasy commented Mar 5, 2025

@catandthemachines This doesn't affect the experience in any other browsers, it just corrects the issue in Safari. The other browsers didn't read out those elements in the first place, so this is just the status quo for those.

Copy link
Contributor

@SonicScrewdriver SonicScrewdriver left a comment

Choose a reason for hiding this comment

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

Looks good to me! Thanks for this great fix. :)

Note: I tried testing what I currently have in storybook and I wasn't able to recreate it with Safari. 🤔 I wonder if this is a more recent bug that they've introduced, as I'm a few versions behind.

y={y}
color={color.blue}
svgPathProps={{
// Use aria-hidden to hide the line from screen readers
Copy link
Contributor

Choose a reason for hiding this comment

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

Ooo fun I never looked into this but I'm glad mafs allowed us to pass props through.

Copy link
Member

@catandthemachines catandthemachines left a comment

Choose a reason for hiding this comment

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

No impact to other screen readers, lets go! 😎

@nishasy
Copy link
Contributor Author

nishasy commented Mar 6, 2025

Update: Third was able to repro when using control + option + arrow keys.

@nishasy nishasy merged commit 88e4e90 into main Mar 6, 2025
13 checks passed
@nishasy nishasy deleted the stop-safari-empty-images branch March 6, 2025 00:11
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