[Preview NG] Provide math keypad in Storybook previews#3766
Draft
jeremywiebe wants to merge 1 commit into
Draft
Conversation
… mobile keypad, if needed
Contributor
|
Size Change: 0 B Total Size: 508 kB ℹ️ View Unchanged
|
Contributor
npm Snapshot: PublishedGood news!! We've packaged up the latest commit from this PR (cc16dcd) and published it to npm. You Example: pnpm add @khanacademy/perseus@PR3766If you are working in Khan Academy's frontend, you can run the below command. ./dev/tools/bump_perseus_version.ts -t PR3766If you are working in Khan Academy's webapp, you can run the below command. ./dev/tools/bump_perseus_version.js -t PR3766 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Fixes several gaps in the Storybook preview harness (
PreviewRenderer/PreviewWithKeypad) that surfaced while reviewing the frontend half of thepreview migration — the frontend preview frame had the same bugs, and fixing
them there exposed that the reference harness shared them.
The question preview rendered a bare
Rendererwith no user-input wiring.Rendereris fully controlled now, so without aUserInputManagerwidgetsreceive
userInput: undefined— numeric-input throws on render and otherinput widgets silently freeze. The question case now wraps
RendererinUserInputManager, and also passeslegacyPerseusLintthrough (the parentsends its
getSaveWarnings()there, but the harness dropped it).The hint preview also rendered a bare
Renderer, ignoringpos. It now usesHintRenderer, which restores the hint labeling/semantics, brings its ownUserInputManager, and forcescustomKeypad: falselike production hintrendering does.
Two keypad cleanups in
PreviewWithKeypad: theMobileKeypadis onlymounted when
isMobile— on desktop it can never activate (widgets pop thedesktop keypad; the editor only sends
customKeypad: truefor phone/tablet),but an inactive
MobileKeypadstill renders a fixed, 1px-bordered containerpinned across the bottom of the preview. And instead of reaching up to
window.frameElement'sdata-*attributes (whichusePreviewPresenterissupposed to encapsulate),
isMobile/hasLintGutternow flow from the hookthrough
PreviewRendereras props — taking aneslint-disablewith them.Issue: LEMS-3741
Test plan:
pnpm typecheck,pnpm lint, andpnpm testnumeric-input or expression) — the preview should render it and accept
typed input instead of crashing/freezing
widget should raise the mobile keypad inside the preview iframe
and expression widgets use the desktop keypad popover
screen-reader position label