Conversation
…n-order-to-prevent-confusing-issues-that-prevent-publishing] [Interactive Graph] Ensure we have defaults for labels in our Locked Figures in order to prevent confusing issues that prevent publishing Ensure defaults exist in both our parser and editor logic Issue: https://khanacademy.atlassian.net/browse/LEMS-4215 Test plan: - TBD
|
Size Change: +29 B (+0.01%) Total Size: 513 kB 📦 View Changed
ℹ️ View Unchanged
|
npm Snapshot: PublishedGood news!! We've packaged up the latest commit from this PR (8812ef8) and published it to npm. You Example: pnpm add @khanacademy/perseus@PR3765If you are working in Khan Academy's frontend, you can run the below command. ./dev/tools/bump_perseus_version.ts -t PR3765If you are working in Khan Academy's webapp, you can run the below command. ./dev/tools/bump_perseus_version.js -t PR3765 |
…n-order-to-prevent-confusing-issues-that-prevent-publishing] docs(changeset): Default addition to parser and editor for labels in locked figures
…n-order-to-prevent-confusing-issues-that-prevent-publishing] Added a test to ensure parser is changing defaults
…n-order-to-prevent-confusing-issues-that-prevent-publishing] docs(changeset): Added defaults to parser for color and size
…n-order-to-prevent-confusing-issues-that-prevent-publishing] Merge branch 'main' into LEMS-4215/ensure-we-have-defaults-for-labels-in-our-locked-figures-in-order-to-prevent-confusing-issues-that-prevent-publishing
…n-order-to-prevent-confusing-issues-that-prevent-publishing] Added regression tests
| text: string, | ||
| color: parseLockedFigureColor, | ||
| size: enumeration("small", "medium", "large"), | ||
| text: defaulted(string, () => "label"), |
There was a problem hiding this comment.
This default doesn't feel very helpful. To me, this signals that we're trying to provide a default, but the problem is actually somewhere else (namely, the editor is allowing folks to save a locked figure with missing info).
There was a problem hiding this comment.
Completely agreed, if I recall, I think I set it to "label" as get-default-figure-for-type.ts also sets it to, I was thinking of maybe changing it to "label not set", something that makes it clear that it isn't something that should be done (unless our aim would be to block saving when it isn't set, though that may be out of scope for this ticket)
What do you think?
There was a problem hiding this comment.
I think the reason I made the labels default to "label" is because it was initially "" and then it wasn't obvious if someone created a label but didn't populate it. Tbh I feel like it doesn't matter much what the default is either way, but I don't think it's necessary to update it to "label not set." Content authors are competent and know that seeing "label" on an interactive graph means they haven't set the label.
There was a problem hiding this comment.
Actually now that I've said that, I'm starting to think we shouldn't have a label default. If we have undefined/empty labels anywhere in our content, and we update the parser so that it's a string now, there could be rogue labels showing up in existing interactive graphs.
There was a problem hiding this comment.
Defaults should really only be provided when we can provide a sensible default. Is the text property not required? If it isn't, then we should leave it undefined. If it is, perhaps a "" is better?
There was a problem hiding this comment.
It doesn't make any sense to have a locked label with no text. The text field is required in the schema.
There was a problem hiding this comment.
Tbh I feel like it doesn't matter much what the default is either way, but I don't think it's necessary to update it to "label not set." Content authors are competent and know that seeing "label" on an interactive graph means they haven't set the label.
We use the parser for learner-facing parsing too, so what happens if we hit this on the learner-side and we default something like "label"?
There was a problem hiding this comment.
@jeremywiebe I'm worried about that case. That's what I meant with my earlier comment
Actually now that I've said that, I'm starting to think we shouldn't have a label default. If we have undefined/empty labels anywhere in our content, and we update the parser so that it's a string now, there could be rogue labels showing up in existing interactive graphs.
If we have a locked label in an existing graph, and for some reason the label is saved in the IG data as an empty string or something, we wouldn't want it to suddenly start showing up as "label"
They're already defaulting to "label" at creation time. I'm not sure there's a reason the parser needs to default the label text. Maybe if it's undefined somehow when it's typed as a required string, we should default it to "" in the parser?
There was a problem hiding this comment.
I think I agree with the idea of defaulting to "" in the parser and having a default undefined in the get-default file, though will wait for like a clear conclusion before making the change
Co-authored-by: Jeremy Wiebe <jeremy@khanacademy.org>
…n-order-to-prevent-confusing-issues-that-prevent-publishing] Merge branch 'main' into LEMS-4215/ensure-we-have-defaults-for-labels-in-our-locked-figures-in-order-to-prevent-confusing-issues-that-prevent-publishing
nishasy
left a comment
There was a problem hiding this comment.
Thanks for adding the regression test!
…n-order-to-prevent-confusing-issues-that-prevent-publishing] Merge branch 'main' into LEMS-4215/ensure-we-have-defaults-for-labels-in-our-locked-figures-in-order-to-prevent-confusing-issues-that-prevent-publishing
…n-order-to-prevent-confusing-issues-that-prevent-publishing] Updated regression snapshots
…n-order-to-prevent-confusing-issues-that-prevent-publishing] Added new default for text and modified test to rreflect
nishasy
left a comment
There was a problem hiding this comment.
Nice!! Thanks for the updates. Looks good to me 🎉
…n-order-to-prevent-confusing-issues-that-prevent-publishing] Merge branch 'main' into LEMS-4215/ensure-we-have-defaults-for-labels-in-our-locked-figures-in-order-to-prevent-confusing-issues-that-prevent-publishing
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@78.3.0 ### Minor Changes - [#3749](#3749) [`c04bfdc6f7`](c04bfdc) Thanks [@EmiliaPalaghita](https://github.com/EmiliaPalaghita)! - Render visible point labels on interactive graphs when the `perseus-enable-point-label-field` flag is on and the graph's `showPointLabels` field is true. Labels reposition to stay on-canvas when a point is near a graph edge. Supported on all interactive graph types except `vector` and `none`. - [#3770](#3770) [`8d6ed38862`](8d6ed38) Thanks [@nishasy](https://github.com/nishasy)! - Add feature flag for renderer upgrade ### Patch Changes - [#3786](#3786) [`f8638119b2`](f863811) Thanks [@catandthemachines](https://github.com/catandthemachines)! - [Interactive Graph] Update screen reader descriptions for exponential graph - [#3798](#3798) [`e08a75689a`](e08a756) Thanks [@catandthemachines](https://github.com/catandthemachines)! - [Interactive Graph] Update screen reader descriptions for logarithm graph - [#3763](#3763) [`a7edbbc724`](a7edbbc) Thanks [@Evelas78](https://github.com/Evelas78)! - Remove pause/play button for single frame gifs - [#3795](#3795) [`81c16ed65f`](81c16ed) Thanks [@ivyolamit](https://github.com/ivyolamit)! - Fix Safari point-label scroll jitter in interactive graph editor - [#3787](#3787) [`6202a5d446`](6202a5d) Thanks [@ivyolamit](https://github.com/ivyolamit)! - [Editor] Improve contrast of editor controls when editing is disabled - [#3699](#3699) [`d34f9758e6`](d34f975) Thanks [@Myranae](https://github.com/Myranae)! - Add scoped AGENTS.md instruction files at repo root, packages/perseus, and packages/perseus/src/widgets; replace CLAUDE.md with symlinks to AGENTS.md so all AI tools read the same canonical source. - [#3799](#3799) [`f65a065bff`](f65a065) Thanks [@catandthemachines](https://github.com/catandthemachines)! - [Interactive Graph] Update screen reader descriptions for vector graph - Updated dependencies \[[`c04bfdc6f7`](c04bfdc), [`a2c520acb9`](a2c520a), [`8d6ed38862`](8d6ed38), [`c9f6ab2e24`](c9f6ab2)]: - @khanacademy/perseus-core@28.3.0 - @khanacademy/pure-markdown@2.3.0 - @khanacademy/keypad-context@3.2.66 - @khanacademy/kmath@2.4.24 - @khanacademy/math-input@26.4.38 - @khanacademy/perseus-linter@5.1.5 - @khanacademy/perseus-score@8.11.8 ## @khanacademy/perseus-core@28.3.0 ### Minor Changes - [#3749](#3749) [`c04bfdc6f7`](c04bfdc) Thanks [@EmiliaPalaghita](https://github.com/EmiliaPalaghita)! - Render visible point labels on interactive graphs when the `perseus-enable-point-label-field` flag is on and the graph's `showPointLabels` field is true. Labels reposition to stay on-canvas when a point is near a graph edge. Supported on all interactive graph types except `vector` and `none`. - [#3770](#3770) [`8d6ed38862`](8d6ed38) Thanks [@nishasy](https://github.com/nishasy)! - Add feature flag for renderer upgrade ### Patch Changes - [#3791](#3791) [`a2c520acb9`](a2c520a) Thanks [@benchristel](https://github.com/benchristel)! - When the `grapher-to-interactive-graph` feature flag is on, Grapher axis labels are now interpreted as TeX. This preserves the existing behavior of Grapher. - [#3765](#3765) [`c9f6ab2e24`](c9f6ab2) Thanks [@Evelas78](https://github.com/Evelas78)! - Provide defaults in the parser for labels in locked figures - Updated dependencies \[[`8d6ed38862`](8d6ed38)]: - @khanacademy/pure-markdown@2.3.0 ## @khanacademy/perseus-editor@33.2.0 ### Minor Changes - [#3749](#3749) [`c04bfdc6f7`](c04bfdc) Thanks [@EmiliaPalaghita](https://github.com/EmiliaPalaghita)! - Render visible point labels on interactive graphs when the `perseus-enable-point-label-field` flag is on and the graph's `showPointLabels` field is true. Labels reposition to stay on-canvas when a point is near a graph edge. Supported on all interactive graph types except `vector` and `none`. - [#3783](#3783) [`6801c10511`](6801c10) Thanks [@EmiliaPalaghita](https://github.com/EmiliaPalaghita)! - Interactive-graph editor: add a "Show point labels" toggle behind the "perseus-enable-point-label-field" flag. Toggling writes `showPointLabels` to the graph JSON. - [#3770](#3770) [`8d6ed38862`](8d6ed38) Thanks [@nishasy](https://github.com/nishasy)! - Add feature flag for renderer upgrade ### Patch Changes - [#3795](#3795) [`81c16ed65f`](81c16ed) Thanks [@ivyolamit](https://github.com/ivyolamit)! - Fix Safari point-label scroll jitter in interactive graph editor - [#3787](#3787) [`6202a5d446`](6202a5d) Thanks [@ivyolamit](https://github.com/ivyolamit)! - [Editor] Improve contrast of editor controls when editing is disabled - [#3797](#3797) [`11d3ec0c95`](11d3ec0) Thanks [@ivyolamit](https://github.com/ivyolamit)! - [Label Image] Modernize the label-image answer-choices controls (delete custom Link component) - Updated dependencies \[[`f8638119b2`](f863811), [`c04bfdc6f7`](c04bfdc), [`e08a75689a`](e08a756), [`a2c520acb9`](a2c520a), [`a7edbbc724`](a7edbbc), [`81c16ed65f`](81c16ed), [`6202a5d446`](6202a5d), [`d34f9758e6`](d34f975), [`8d6ed38862`](8d6ed38), [`c9f6ab2e24`](c9f6ab2), [`f65a065bff`](f65a065)]: - @khanacademy/perseus@78.3.0 - @khanacademy/perseus-core@28.3.0 - @khanacademy/keypad-context@3.2.66 - @khanacademy/kmath@2.4.24 - @khanacademy/math-input@26.4.38 - @khanacademy/perseus-linter@5.1.5 - @khanacademy/perseus-score@8.11.8 ## @khanacademy/pure-markdown@2.3.0 ### Minor Changes - [#3770](#3770) [`8d6ed38862`](8d6ed38) Thanks [@nishasy](https://github.com/nishasy)! - Add feature flag for renderer upgrade ## @khanacademy/keypad-context@3.2.66 ### Patch Changes - Updated dependencies \[[`c04bfdc6f7`](c04bfdc), [`a2c520acb9`](a2c520a), [`8d6ed38862`](8d6ed38), [`c9f6ab2e24`](c9f6ab2)]: - @khanacademy/perseus-core@28.3.0 ## @khanacademy/kmath@2.4.24 ### Patch Changes - Updated dependencies \[[`c04bfdc6f7`](c04bfdc), [`a2c520acb9`](a2c520a), [`8d6ed38862`](8d6ed38), [`c9f6ab2e24`](c9f6ab2)]: - @khanacademy/perseus-core@28.3.0 ## @khanacademy/math-input@26.4.38 ### Patch Changes - Updated dependencies \[[`c04bfdc6f7`](c04bfdc), [`a2c520acb9`](a2c520a), [`8d6ed38862`](8d6ed38), [`c9f6ab2e24`](c9f6ab2)]: - @khanacademy/perseus-core@28.3.0 - @khanacademy/keypad-context@3.2.66 ## @khanacademy/perseus-linter@5.1.5 ### Patch Changes - Updated dependencies \[[`c04bfdc6f7`](c04bfdc), [`a2c520acb9`](a2c520a), [`8d6ed38862`](8d6ed38), [`c9f6ab2e24`](c9f6ab2)]: - @khanacademy/perseus-core@28.3.0 - @khanacademy/pure-markdown@2.3.0 - @khanacademy/kmath@2.4.24 ## @khanacademy/perseus-score@8.11.8 ### Patch Changes - Updated dependencies \[[`c04bfdc6f7`](c04bfdc), [`a2c520acb9`](a2c520a), [`8d6ed38862`](8d6ed38), [`c9f6ab2e24`](c9f6ab2)]: - @khanacademy/perseus-core@28.3.0 - @khanacademy/kmath@2.4.24 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Summary:
Ensure defaults exist in both our parser and editor logic
Issue: https://khanacademy.atlassian.net/browse/LEMS-4215
Test plan: