Skip to content

[Interactive Graph] Ensure we have defaults for labels in our Locked Figures - #3765

Merged
Evelas78 merged 13 commits into
mainfrom
LEMS-4215/ensure-we-have-defaults-for-labels-in-our-locked-figures-in-order-to-prevent-confusing-issues-that-prevent-publishing
Jun 23, 2026
Merged

[Interactive Graph] Ensure we have defaults for labels in our Locked Figures#3765
Evelas78 merged 13 commits into
mainfrom
LEMS-4215/ensure-we-have-defaults-for-labels-in-our-locked-figures-in-order-to-prevent-confusing-issues-that-prevent-publishing

Conversation

@Evelas78

@Evelas78 Evelas78 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Summary:

Ensure defaults exist in both our parser and editor logic

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

Test plan:

  • Verify using jest tests to confirm that the default is detected correctly when color and size is passed in as undefined

…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
@Evelas78 Evelas78 self-assigned this Jun 11, 2026
@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Size Change: +29 B (+0.01%)

Total Size: 513 kB

📦 View Changed
Filename Size Change
packages/perseus-core/dist/es/index.item-splitting.js 12.3 kB +15 B (+0.12%)
packages/perseus-core/dist/es/index.js 27.3 kB +14 B (+0.05%)
ℹ️ View Unchanged
Filename Size
packages/kas/dist/es/index.js 20.6 kB
packages/keypad-context/dist/es/index.js 1 kB
packages/kmath/dist/es/index.js 6.32 kB
packages/math-input/dist/es/index.js 98.5 kB
packages/math-input/dist/es/strings.js 1.61 kB
packages/perseus-editor/dist/es/index.js 105 kB
packages/perseus-linter/dist/es/index.js 9.8 kB
packages/perseus-score/dist/es/index.js 10.2 kB
packages/perseus-utils/dist/es/index.js 403 B
packages/perseus/dist/es/index.js 203 kB
packages/perseus/dist/es/strings.js 8.6 kB
packages/pure-markdown/dist/es/index.js 1.39 kB
packages/simple-markdown/dist/es/index.js 6.71 kB

compressed-size-action

@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

npm Snapshot: Published

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

Example:

pnpm add @khanacademy/perseus@PR3765

If you are working in Khan Academy's frontend, you can run the below command.

./dev/tools/bump_perseus_version.ts -t PR3765

If 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
Evelas78 and others added 3 commits June 12, 2026 11:04
…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
@Evelas78 Evelas78 added the item-splitting-change-ack Acknowledges that this PR's item-splitting bundle change has been reviewed label Jun 15, 2026
@Evelas78
Evelas78 requested review from ivyolamit, jeremywiebe and nishasy and removed request for jeremywiebe June 15, 2026 16:44
@Evelas78
Evelas78 marked this pull request as ready for review June 15, 2026 16:44
@Evelas78
Evelas78 marked this pull request as draft June 15, 2026 20:14
Evelas78 added 2 commits June 15, 2026 17:35
…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
@Evelas78
Evelas78 marked this pull request as ready for review June 16, 2026 16:19
@Evelas78
Evelas78 marked this pull request as draft June 16, 2026 16:20
@Evelas78
Evelas78 marked this pull request as ready for review June 16, 2026 16:20
@Evelas78 Evelas78 changed the title [Interactive Graph] Ensure we have defaults for labels in our Locked Figures in order to prevent confusing issues that prevent publishing [Interactive Graph] Ensure we have defaults for labels in our Locked Figures Jun 17, 2026
text: string,
color: parseLockedFigureColor,
size: enumeration("small", "medium", "large"),
text: defaulted(string, () => "label"),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It doesn't make any sense to have a locked label with no text. The text field is required in the schema.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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"?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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

Comment thread .changeset/thirty-cheetahs-know.md Outdated
Evelas78 and others added 2 commits June 17, 2026 14:17
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 nishasy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for adding the regression test!

Evelas78 added 2 commits June 18, 2026 09:29
…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 nishasy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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
@Evelas78
Evelas78 merged commit c9f6ab2 into main Jun 23, 2026
12 checks passed
@Evelas78
Evelas78 deleted the LEMS-4215/ensure-we-have-defaults-for-labels-in-our-locked-figures-in-order-to-prevent-confusing-issues-that-prevent-publishing branch June 23, 2026 14:43
handeyeco pushed a commit that referenced this pull request Jun 24, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

item-splitting-change item-splitting-change-ack Acknowledges that this PR's item-splitting bundle change has been reviewed olc-5.0.7fb98

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants