-
Notifications
You must be signed in to change notification settings - Fork 351
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
feat(LEMS-2525): move position of visible label in aria label #1739
Conversation
GeraldRequired Reviewers
Don't want to be involved in this pull request? Comment |
Size Change: -54 B (-0.01%) Total Size: 866 kB
ℹ️ View Unchanged
|
npm Snapshot: PublishedGood news!! We've packaged up the latest commit from this PR (2ea6f20) and published it to npm. You Example: yarn add @khanacademy/perseus@PR1739 If you are working in Khan Academy's webapp, you can run: ./dev/tools/bump_perseus_version.sh -t PR1739 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we might want to have some kind of punctuation between labels. Overall, though, this looks good to me!
(I realize we haven't talked about how each of us approaches code reviews. I try to follow our LEMS guidelines. None of my comments in this review are blocking; if you've read my comments, made whatever updates you feel are right, and have no further questions, I'm happy for this to land.)
@@ -495,8 +495,7 @@ describe("LockedEllipseSettings", () => { | |||
|
|||
// Assert | |||
expect(onChangeProps).toHaveBeenCalledWith({ | |||
ariaLabel: | |||
"Circle with radius 2, centered at (0, 0), with label A", | |||
ariaLabel: "Circle A with radius 2, centered at (0, 0)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where did we land on spelling out punctuation with words (slack discussion)? I think the coordinates should either be written
centered at left parenthesis 0 comma 0 right parenthesis
or
centered at 0 comma 0
EDIT: okay, I see that that change is out of scope for this PR (which is just about moving the visible labels). Cool cool.
...rseus-editor/src/widgets/interactive-graph-editor/locked-figures/locked-ellipse-settings.tsx
Show resolved
Hide resolved
@@ -819,7 +819,7 @@ describe("Locked Function Settings", () => { | |||
|
|||
// Assert | |||
expect(onChangeProps).toHaveBeenCalledWith({ | |||
ariaLabel: "Function with equation y=x^2, with labels A, B", | |||
ariaLabel: "Function A B with equation y=x^2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Random thought: I wonder how screenreaders will handle stuff like x^2
.
We could use the Speech Rule Engine that comes with MathJax to convert this to words (x squared
). I think it would be okay to add a dependency on MathJax to the perseus-editor
package for that purpose. The speech rule engine is pretty big, but since this code is not loaded on the learner-facing site, bundle size is less of a concern.
You can find an example of the SpeechRuleEngine in use in mathquill-instance.ts
:
perseus/packages/math-input/src/components/input/mathquill-instance.ts
Lines 136 to 138 in 5e30fcd
SpeechRuleEngine.setup(locale).then((SRE) => | |
mathField.setMathspeakOverride(SRE.texToSpeech), | |
); |
It's kind of annoying that setting up the SpeechRuleEngine is async, but I think that once we get over that hurdle, we can call:
SRE.texToSpeech("y=x^2")
and it will generate the text for us.
We can set the SRE's locale to "en"
, because these strings will be translated manually along with the rest of the content.
Unfortunately, there will be a few additional complications with this approach. I believe our current syntax for locked function equations uses e.g. sin(x)
and cos(x)
for trig functions, and those won't render correctly when interpreted as TeX. TeX systems will interpret them as e.g. s i n x
(four separate variables).
For some functions, the fix will be quick: the correct syntax is \sin(x)
, \cos(x)
, \tan(x)
, etc. I'm not sure what all the available functions are for locked functions, though. E.g. do we have atan
/ arctan
? How about sec
and csc
? ln
? We'd want to make sure all the possible functions render correctly when converted to TeX.
Sorry for the wall of text, but I just realized that this is significant additional scope and wanted to write all my thoughts down before I forget them. No action needed for this PR, but I think it's probably worth having a conversation with Caitlyn and content creators about what they need/expect.
...seus-editor/src/widgets/interactive-graph-editor/locked-figures/locked-function-settings.tsx
Outdated
Show resolved
Hide resolved
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @khanacademy/perseus@38.0.0 ### Major Changes - [#1717](#1717) [`8a40e99e6`](8a40e99) Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Remove duplicate WidgetDict type and bespoke typings of `widgets` in favour of `PerseusWidgetsMap` type. ### Patch Changes - [#1752](#1752) [`c4d96ccaf`](c4d96cc) Thanks [@mark-fitzgerald](https://github.com/mark-fitzgerald)! - BUGFIX - [Number Line] - Tick labels not showing in some exercises - [#1730](#1730) [`2cc20b32e`](2cc20b3) Thanks [@Myranae](https://github.com/Myranae)! - Refine Grapher types and clean up relevant code ## @khanacademy/perseus-editor@14.8.0 ### Minor Changes - [#1739](#1739) [`ab0a10eec`](ab0a10e) Thanks [@anakaren-rojas](https://github.com/anakaren-rojas)! - updates position of visible label within aria label ### Patch Changes - [#1717](#1717) [`8a40e99e6`](8a40e99) Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Remove duplicate WidgetDict type and bespoke typings of `widgets` in favour of `PerseusWidgetsMap` type. - Updated dependencies \[[`8a40e99e6`](8a40e99), [`c4d96ccaf`](c4d96cc), [`2cc20b32e`](2cc20b3)]: - @khanacademy/perseus@38.0.0 Author: khan-actions-bot Reviewers: mark-fitzgerald Required Reviewers: Approved By: mark-fitzgerald Checks: ⏭️ Publish npm snapshot, ✅ Check builds for changes in size (ubuntu-latest, 20.x), ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ Cypress (ubuntu-latest, 20.x), ✅ gerald Pull Request URL: #1750
Summary:
Moves the position of the visible label
New aria label structure will be:
Element Type
Visible Label(s)
Math Details
Visual Traits
Issue: LEMS-2525
Test plan:
Add widget
dropdownAdd locked figure
dropdown - select any from the dropdownScreenshots
Screen.Recording.2024-10-10.at.1.47.25.PM.mov