[Start Coords] Fix the radius input in circle graph start coords UI #1509
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:
The Radius input in the Circle graph start coords UI is not allowing
people to type in non-numbers, even mid-typing a valid number.
For example, when typing "0" to start "0.5", it auto-updates to 2 (default radius),
and it doesn't allow typing "." to start ".5".
This is happening because the radius is only reading the prop updates and passing
the evaluated value instead of storing the state for the input.
Adding a
React.useState
in thestart-coords-circle.tsx
file to fix this.Issue: https://khanacademy.atlassian.net/browse/LEMS-2244
Test plan:
yarn jest packages/perseus-editor/src/components/__tests__/start-coords-settings.test.tsx
Storybook
Demos:
In both videos, I'm highlighting the input and typing in "0" and then pressing backspace.
Before
Notice that "0" auto-updates the field to "2" and backspacing does nothing.
Screen.Recording.2024-08-09.at.5.06.40.PM.mov
After
Typing in 0, ., and backspace work as expected.
Screen.Recording.2024-08-09.at.5.07.04.PM.mov