-
Notifications
You must be signed in to change notification settings - Fork 352
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
[Locked Figure Aria] Locked function aria labels (graph + editor) #1687
Conversation
npm Snapshot: PublishedGood news!! We've packaged up the latest commit from this PR (d628478) and published it to npm. You Example: yarn add @khanacademy/perseus@PR1687 If you are working in Khan Academy's webapp, you can run: ./dev/tools/bump_perseus_version.sh -t PR1687 |
Size Change: +98 B (+0.01%) Total Size: 864 kB
ℹ️ View Unchanged
|
GeraldRequired Reviewers
Don't want to be involved in this pull request? Comment |
<g | ||
className="locked-function" | ||
aria-label={hasAria ? props.ariaLabel : undefined} | ||
aria-hidden={!hasAria} |
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.
Why is aria-hidden
needed here? Does the screenreader read something for this SVG element if there's no aria-label
?
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.
Yes! It says "empty group"
const input = screen.getByRole("textbox", {name: "Aria label"}); | ||
|
||
// Assert | ||
expect(input).toHaveValue("Ellipse at (x, y)"); |
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.
Maybe this label shouldn't contain Ellipse
- just to avoid confusion :)
// Add the domain/range constraints to the aria label | ||
// if they are not the default values. | ||
if (domain && !(domain[0] === -Infinity && domain[1] === Infinity)) { | ||
str += `, ${domainRangeText} from ${domain[0]} to ${domain[1]}`; |
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, rather than using ${domainRangeText}
, we always want this word to be domain
. IIUC, the domain of a function is always the set of input values, so if the function has the form x = f(y)
, the domain is a set of y coordinates.
Might be good to confirm this with math content creators, though.
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.
That is a good point! I'll ask
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 haven't gotten a response from the content authors yet, but I think you're right. I'll change it to domain
here and in the editor UI. If a change is requested in the future, we can update it. For now, I'd like to unblock this so I can keep landing all the PRs stacked on top of this.
… referring to input values.
@@ -223,7 +248,7 @@ const LockedFunctionSettings = (props: Props) => { | |||
tag="label" | |||
style={[styles.dropdownLabel, styles.domainMin]} |
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.
Does the label component for domain min also need an aria label like the domain max one?
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.
No, it's automatically labeled by the label itself. You can see in the test file that the aria labels successfully get set as "domain min"
and "domain max"
.
@@ -80,6 +81,30 @@ const LockedFunctionSettings = (props: Props) => { | |||
]); | |||
}, [domain]); | |||
|
|||
function getPrepopulatedAriaLabel() { | |||
let str = `Function with equation ${equationPrefix}${equation}`; | |||
|
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.
Should there be an additional check to validate that there is text added to the labels? Or make the text a required field if the button to add a visible label is clicked?
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 did think about that, and that is a good point. I do agree with you. Unfortunately, validation in the content editor has been deprioritized in favor of just trusting the content authors and giving them ultimate freedom. The content authors should definitely be checking that the label makes sense before saving this on the exercise.
If this ends up being an issue and content authors ask for extra validation, we would definitely add that in the future.
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.
LGTM!
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@35.1.0 ### Minor Changes - [#1687](#1687) [`c0cbb484a`](c0cbb48) Thanks [@nishasy](https://github.com/nishasy)! - [Locked Figure Aria] Locked function aria labels (graph + editor) - [#1690](#1690) [`a65da60c2`](a65da60) Thanks [@nishasy](https://github.com/nishasy)! - [Locked Figure Labels] Add/edit/delete locked polygon labels - [#1683](#1683) [`2d7cadaf0`](2d7cada) Thanks [@nishasy](https://github.com/nishasy)! - [Locked Figure Aria] Implement locked line aria label behavior on graph - [#1691](#1691) [`fc16bc77f`](fc16bc7) Thanks [@nishasy](https://github.com/nishasy)! - [Locked Figure Aria] Locked polygon aria labels (graph + editor) - [#1677](#1677) [`3c73f4aa4`](3c73f4a) Thanks [@nishasy](https://github.com/nishasy)! - [Locked Figure Aria] Implement locked point aria label behavior on graph - [#1684](#1684) [`17ebfc0de`](17ebfc0) Thanks [@nishasy](https://github.com/nishasy)! - [Locked Figure Aria] Locked line aria label editor UI - [#1685](#1685) [`b3de0d80e`](b3de0d8) Thanks [@nishasy](https://github.com/nishasy)! - [Locked Figure Aria] Implement locked vector aria labels (graph + editor) - [#1689](#1689) [`eda436f00`](eda436f) Thanks [@nishasy](https://github.com/nishasy)! - [Locked Figure Labels] View locked polygon labels - [#1682](#1682) [`039e0a360`](039e0a3) Thanks [@nishasy](https://github.com/nishasy)! - [Locked Figure Aria] Locked point aria label editor UI - [#1686](#1686) [`8230d96ee`](8230d96) Thanks [@nishasy](https://github.com/nishasy)! - [Locked Figure Aria] Implement locked ellipse aria labels (graph + editor) ### Patch Changes - [#1702](#1702) [`30725ec88`](30725ec) Thanks [@handeyeco](https://github.com/handeyeco)! - Split out validation logic for NumberLine - [#1671](#1671) [`f326139ee`](f326139) Thanks [@handeyeco](https://github.com/handeyeco)! - Move and test Grapher's validator - [#1704](#1704) [`82e0ebd71`](82e0ebd) Thanks [@handeyeco](https://github.com/handeyeco)! - Split out validation logic from table - [#1664](#1664) [`c41e4b2f3`](c41e4b2) Thanks [@benchristel](https://github.com/benchristel)! - Omit unused data from interactive graph onChange callback - [#1678](#1678) [`49efaaff5`](49efaaf) Thanks [@handeyeco](https://github.com/handeyeco)! - Port some tests to new custom matcher - [#1676](#1676) [`f5af24371`](f5af243) Thanks [@benchristel](https://github.com/benchristel)! - Internal: remove dead code from InteractiveGraph.validate() - [#1698](#1698) [`339a6db38`](339a6db) Thanks [@handeyeco](https://github.com/handeyeco)! - Refine Expression's Rubric type - [#1700](#1700) [`493715e3d`](493715e) Thanks [@handeyeco](https://github.com/handeyeco)! - Split out InteractiveGraph validator - [#1705](#1705) [`e432666fd`](e432666) Thanks [@Myranae](https://github.com/Myranae)! - Move validation logic out of the iframe widget and add tests - [#1693](#1693) [`466d010c6`](466d010) Thanks [@nishasy](https://github.com/nishasy)! - [Locked Figure Labels] Add color select to locked figure labels settings - [#1707](#1707) [`d3767f720`](d3767f7) Thanks [@handeyeco](https://github.com/handeyeco)! - Split out matcherValidator from Matcher - [#1670](#1670) [`463755970`](4637559) Thanks [@handeyeco](https://github.com/handeyeco)! - Split validation logic out of Matrix - [#1688](#1688) [`10ce86925`](10ce869) Thanks [@Myranae](https://github.com/Myranae)! - Move validation logic out of the cs-program widget and add tests - [#1703](#1703) [`e818b0f15`](e818b0f) Thanks [@handeyeco](https://github.com/handeyeco)! - Split out Plotter validator ## @khanacademy/perseus-editor@14.6.0 ### Minor Changes - [#1687](#1687) [`c0cbb484a`](c0cbb48) Thanks [@nishasy](https://github.com/nishasy)! - [Locked Figure Aria] Locked function aria labels (graph + editor) - [#1690](#1690) [`a65da60c2`](a65da60) Thanks [@nishasy](https://github.com/nishasy)! - [Locked Figure Labels] Add/edit/delete locked polygon labels - [#1683](#1683) [`2d7cadaf0`](2d7cada) Thanks [@nishasy](https://github.com/nishasy)! - [Locked Figure Aria] Implement locked line aria label behavior on graph - [#1691](#1691) [`fc16bc77f`](fc16bc7) Thanks [@nishasy](https://github.com/nishasy)! - [Locked Figure Aria] Locked polygon aria labels (graph + editor) - [#1677](#1677) [`3c73f4aa4`](3c73f4a) Thanks [@nishasy](https://github.com/nishasy)! - [Locked Figure Aria] Implement locked point aria label behavior on graph - [#1684](#1684) [`17ebfc0de`](17ebfc0) Thanks [@nishasy](https://github.com/nishasy)! - [Locked Figure Aria] Locked line aria label editor UI - [#1685](#1685) [`b3de0d80e`](b3de0d8) Thanks [@nishasy](https://github.com/nishasy)! - [Locked Figure Aria] Implement locked vector aria labels (graph + editor) - [#1689](#1689) [`eda436f00`](eda436f) Thanks [@nishasy](https://github.com/nishasy)! - [Locked Figure Labels] View locked polygon labels - [#1682](#1682) [`039e0a360`](039e0a3) Thanks [@nishasy](https://github.com/nishasy)! - [Locked Figure Aria] Locked point aria label editor UI - [#1686](#1686) [`8230d96ee`](8230d96) Thanks [@nishasy](https://github.com/nishasy)! - [Locked Figure Aria] Implement locked ellipse aria labels (graph + editor) ### Patch Changes - [#1706](#1706) [`624be8143`](624be81) Thanks [@nishasy](https://github.com/nishasy)! - [Locked Figures Aria] Use TextArea instead of TextField in the locked figures aria settings - [#1693](#1693) [`466d010c6`](466d010) Thanks [@nishasy](https://github.com/nishasy)! - [Locked Figure Labels] Add color select to locked figure labels settings - Updated dependencies \[[`30725ec88`](30725ec), [`c0cbb484a`](c0cbb48), [`f326139ee`](f326139), [`a65da60c2`](a65da60), [`82e0ebd71`](82e0ebd), [`c41e4b2f3`](c41e4b2), [`2d7cadaf0`](2d7cada), [`49efaaff5`](49efaaf), [`fc16bc77f`](fc16bc7), [`f5af24371`](f5af243), [`339a6db38`](339a6db), [`3c73f4aa4`](3c73f4a), [`17ebfc0de`](17ebfc0), [`493715e3d`](493715e), [`e432666fd`](e432666), [`466d010c6`](466d010), [`b3de0d80e`](b3de0d8), [`eda436f00`](eda436f), [`d3767f720`](d3767f7), [`463755970`](4637559), [`10ce86925`](10ce869), [`039e0a360`](039e0a3), [`8230d96ee`](8230d96), [`e818b0f15`](e818b0f)]: - @khanacademy/perseus@35.1.0 Author: khan-actions-bot Reviewers: benchristel Required Reviewers: Approved By: benchristel Checks: ⏭️ Publish npm snapshot, ✅ Cypress (ubuntu-latest, 20.x), ✅ 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), ✅ gerald Pull Request URL: #1680
Summary:
Issue: https://khanacademy.atlassian.net/browse/LEMS-2380
Test plan:
yarn jest packages/perseus/src/widgets/interactive-graphs/interactive-graph.test.tsx
yarn jest packages/perseus-editor/src/widgets/interactive-graph-editor/locked-figures/locked-function-settings.test.tsx
Storybook
Graph behavior
Editor
Screenshots & Videos
Graph experience
locked-function-experience.mov
Editor
Screen.Recording.2024-09-26.at.4.50.50.PM.mov