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] Polygon (limited) - Add screen reader experience #2173

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

nishasy
Copy link
Contributor

@nishasy nishasy commented Jan 30, 2025

Summary:

Add the aria labels and descriptions for the full graph and interactive elements in the Fixed Polygon graph, based on the SRUX doc.

The Unlimited Polygon SR experience will be added in a separate PR.

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

Test plan:

yarn jest packages/perseus/src/widgets/interactive-graphs/graphs/polygon.test.tsx
yarn jest packages/perseus/src/widgets/interactive-graphs/graphs/utils.test.ts

Storybook
http://localhost:6006/iframe.html?globals=&id=perseuseditor-widgets-interactive-graph--interactive-graph-polygon&viewMode=story

@nishasy nishasy self-assigned this Jan 30, 2025
Copy link
Contributor

github-actions bot commented Jan 30, 2025

npm Snapshot: Published

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

Example:

yarn add @khanacademy/perseus@PR2173

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

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

Copy link
Contributor

github-actions bot commented Jan 30, 2025

Size Change: +1.92 kB (+0.13%)

Total Size: 1.48 MB

Filename Size Change
packages/perseus/dist/es/index.js 384 kB +1.71 kB (+0.45%)
packages/perseus/dist/es/strings.js 6.02 kB +208 B (+3.58%)
ℹ️ 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.8 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 43.5 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 113 kB
packages/pure-markdown/dist/es/index.js 3.66 kB
packages/simple-markdown/dist/es/index.js 12.5 kB

compressed-size-action

<UnlimitedPolygonGraph {...statefulProps} />
) : (
<LimitedPolygonGraph {...statefulProps} />
);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed this to render as components this so I could use hooks inside each component separately. Otherwise it gives me a conditional hook error and crashes in the editor when changing between fixed and unlimited polygon graph type.

I prefer this over having a whole bunch of hooks up here in the parent that may or may not apply to the two different components and passing them down.

srPolygonInteractiveElements: string;
};

function describePolygonGraph(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't export this one for testing, because I tested all these strings inside the LimitedPolygon component since it's called in there.

export function srFormatNumber(
a: number,
locale: string,
maximumFractionDigits?: number,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding this parameter so that the screen reader label for the side angles can match what's presented by the "show angles" button (which is only one decimal point).

@nishasy nishasy changed the title DRAFT!! DO NOT REVIEW - [SR] Polygon - Add screen reader experience [SR] Polygon - Add screen reader experience Feb 1, 2025
@nishasy nishasy changed the title [SR] Polygon - Add screen reader experience [SR] Polygon (not limited - Add screen reader experience Feb 1, 2025
@nishasy nishasy changed the title [SR] Polygon (not limited - Add screen reader experience [SR] Polygon (limited) - Add screen reader experience Feb 1, 2025
@nishasy nishasy marked this pull request as ready for review February 1, 2025 01:04
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