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

[axes-aria-descriptions] [SR] Add aria-labels for x- and y-axis labels #2221

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

nishasy
Copy link
Contributor

@nishasy nishasy commented Feb 8, 2025

Summary:

Right now if a person using a screen reader traverses through the graph, they hear "x, math" and "y, math" for the axis labels, or whatever the x and y labels are updated to by the content authors.

We need to add a description for this so people know what x and y are referring to.

  • Added "X-axis" and "Y-axis" strings as aria-labels for the AxisLabel elements.
  • This means that it reads the actual label as a child of this axis label group
  • This is my preferred approach so that it already handles math speech wehen reading the
    TeX label, and we don't have to manually use the speech rule engine again redundantly

Issue: https://khanacademy.atlassian.net/browse/LEMS-2844

Test plan:

yarn jest packages/perseus/src/widgets/interactive-graphs/mafs-graph.test.tsx

Storybook

Right now if a person using a screen reader traverses through the graph, they hear "x, math" and "y, math" for the axis labels, or whatever the x and y labels are updated to by the content authors.

We need to add a description for this so people know what x and y are referring to.

- Added "X-axis" and "Y-axis" strings as `aria-label`s for the `AxisLabel` elements.
- This means that it reads the actual label as a child of this axis label group
- This is my preferred approach so that it already handles math speech wehen reading the
  TeX label, and we don't have to manually use the speech rule engine again redundantly

Issue: https://khanacademy.atlassian.net/browse/LEMS-2844

Test plan:
`yarn jest packages/perseus/src/widgets/interactive-graphs/mafs-graph.test.tsx`

Storybook
- Go to any interactive graph editor story (http://localhost:6006/iframe.html?globals=&args=&id=perseuseditor-widgets-interactive-graph--interactive-graph-segment&viewMode=story)
- Use the screen reader to confirm that the axis labels now say "X-axis, group"
- Continue using the screen reader and make sure that the actual axis label is read
- Update the x and y labels to have some kind of math TeX like `\frac{1}{2}`
- Repeat the above steps and confirm that the screen reader reads the math correctly
@nishasy nishasy self-assigned this Feb 8, 2025
@@ -17,6 +17,8 @@ import type {InteractiveGraphState} from "./types";
import type {GraphRange} from "@khanacademy/perseus-core";
import type {UserEvent} from "@testing-library/user-event";

const baseMafsProps = getBaseMafsGraphPropsForTests();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

While I was in this file, I took this as an opportunity to reduce the number of function calls being made.

Copy link
Contributor

github-actions bot commented Feb 8, 2025

npm Snapshot: Published

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

Example:

yarn add @khanacademy/perseus@PR2221

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

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

Copy link
Contributor

github-actions bot commented Feb 8, 2025

Size Change: +61 B (0%)

Total Size: 1.48 MB

Filename Size Change
packages/perseus/dist/es/index.js 379 kB +41 B (+0.01%)
packages/perseus/dist/es/strings.js 6.08 kB +20 B (+0.33%)
ℹ️ View Unchanged
Filename Size
packages/kas/dist/es/index.js 39 kB
packages/keypad-context/dist/es/index.js 760 B
packages/kmath/dist/es/index.js 86.9 kB
packages/math-input/dist/es/index.js 77.6 kB
packages/math-input/dist/es/strings.js 1.79 kB
packages/perseus-core/dist/es/index.js 46.3 kB
packages/perseus-editor/dist/es/index.js 688 kB
packages/perseus-linter/dist/es/index.js 22.2 kB
packages/perseus-score/dist/es/index.js 115 kB
packages/pure-markdown/dist/es/index.js 3.66 kB
packages/simple-markdown/dist/es/index.js 12.5 kB

compressed-size-action

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