Skip to content

[wip] Add toggle for showing preview unshuffled in radio editor#3245

Draft
Myranae wants to merge 13 commits intomainfrom
tb/LEMS-3710/toggle-for-shuffle
Draft

[wip] Add toggle for showing preview unshuffled in radio editor#3245
Myranae wants to merge 13 commits intomainfrom
tb/LEMS-3710/toggle-for-shuffle

Conversation

@Myranae
Copy link
Contributor

@Myranae Myranae commented Feb 11, 2026

Summary:

Problem

Content creators found the Edit tab sidebar preview unhelpful when choices were shuffled — it was hard to map shuffled preview choices back to the editor fields they were authoring.

Solution

Added a "Shuffle preview" toggle to the Radio widget editor that controls whether the Edit tab sidebar preview shows choices in shuffled or unshuffled order. The toggle defaults to off (unshuffled), giving creators a predictable editing experience. The Preview tab always respects the randomize setting and is unaffected by this toggle.

Architecture

The toggle state is editor-only and ephemeral — it is not persisted to content data. It flows through the existing onChange/serialize pipeline as a marker field (_showShuffledPreview), which is:

  • Processed in serializeForPreview() to control whether the sidebar preview shuffles choices
  • Stripped in serialize() (the save path) and getSnapshotBeforeUpdate (the JSON mode path) via a shared helper to ensure it never reaches stored content

No changes were made to the core shuffle logic or the widget rendering layer — all changes are confined to the editor.


Co-authored by Claude Opus 4.6

Issue: LEMS-3710

Test plan:

  • Confirm all checks pass
  • Test new toggle in Storybook
  • Build ZND in frontend and test in Editor

@Myranae Myranae self-assigned this Feb 11, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 11, 2026

🗄️ Schema Change: No Changes ✅

@github-actions
Copy link
Contributor

github-actions bot commented Feb 11, 2026

🛠️ Item Splitting: No Changes ✅

@github-actions
Copy link
Contributor

github-actions bot commented Feb 11, 2026

Size Change: +441 B (+0.09%)

Total Size: 485 kB

Filename Size Change
packages/perseus-editor/dist/es/index.js 99.7 kB +441 B (+0.44%)
ℹ️ View Unchanged
Filename Size
packages/kas/dist/es/index.js 20.8 kB
packages/keypad-context/dist/es/index.js 1 kB
packages/kmath/dist/es/index.js 5.98 kB
packages/math-input/dist/es/index.js 98.5 kB
packages/math-input/dist/es/strings.js 1.61 kB
packages/perseus-core/dist/es/index.item-splitting.js 11.8 kB
packages/perseus-core/dist/es/index.js 24.8 kB
packages/perseus-linter/dist/es/index.js 8.83 kB
packages/perseus-score/dist/es/index.js 9.26 kB
packages/perseus-utils/dist/es/index.js 403 B
packages/perseus/dist/es/index.js 187 kB
packages/perseus/dist/es/strings.js 7.44 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
Copy link
Contributor

github-actions bot commented Feb 11, 2026

npm Snapshot: Published

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

Example:

pnpm add @khanacademy/perseus@PR3245

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

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

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

./dev/tools/bump_perseus_version.js -t PR3245

…isclosure branch

This branch was based off a branch with some additional documentation for Claude and some changes to its CLAUDE.md. Those files are not yet landed, so removed those. Missed this changeset.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant