-
Notifications
You must be signed in to change notification settings - Fork 353
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Locked Figure Labels] Util function to generate spoken math + use it…
… within Locked Point aria labels (#1839) ## Summary: When auto-generating the aria labels for locked figures, we want it to use words as if they were spoken rather than math expressions that might be read incorrectly by the screen reader. - Create a utility function using the MathJax speech engine that converts math details (TeX denoted by the `$...$` blocks) to spoken words. - Use this utility within LockedPointSettings. (Async + useEffect because the speech engine is async. I had to use mocks in the tests for this.) If this approach is given the okay, I'll go ahead and apply it to the other locked figures as well in a following PR. Issue: https://khanacademy.atlassian.net/browse/LEMS-2548 ## Test plan: `yarn jest packages/perseus-editor/src/widgets/interactive-graph-editor/locked-figures/util.test.ts` `yarn jest packages/perseus-editor/src/widgets/interactive-graph-editor/locked-figures/locked-point-settings.test.tsx` Storybook - `http://localhost:6006/iframe.html?args=&id=perseuseditor-widgets-interactive-graph--mafs-with-locked-figure-labels-all-flags&viewMode=story` - Open the locked point settings - Change the visible label to have a mix of TeX (with `$...$`) and non-TeX - Press the "Auto-generate" button - Confirm that the input changes to include spoken math words for the Tex - Also try this with no labels and with multiple labels <img width="387" alt="image" src="https://github.com/user-attachments/assets/f5bd3d47-9e93-47ee-8af9-ec217a6cbbae"> ### Loading state demo https://github.com/user-attachments/assets/1ee80dee-3b10-46ab-b3f5-d296612b7a07 Author: nishasy Reviewers: benchristel, nishasy, anakaren-rojas, catandthemachines Required Reviewers: Approved By: anakaren-rojas, benchristel Checks: ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ✅ Cypress (ubuntu-latest, 20.x), ✅ Check builds for changes in size (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ Publish Storybook to Chromatic (ubuntu-latest, 20.x), ✅ gerald Pull Request URL: #1839
- Loading branch information
Showing
7 changed files
with
170 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@khanacademy/perseus": patch | ||
"@khanacademy/perseus-editor": patch | ||
--- | ||
|
||
[Locked Figure Labels] Util function to generate spoken math + use it within Locked Point aria labels |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters