Fix issue with typing formatted values into st.number_input#12351
Fix issue with typing formatted values into st.number_input#12351lukasmasuch merged 3 commits intodevelopfrom
st.number_input#12351Conversation
🎉 Snyk checks have passed. No issues have been found so far.✅ security/snyk check is complete. No issues have been found. (View Details) ✅ license/snyk check is complete. No issues have been found. (View Details) |
✅ PR preview is ready!
|
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a regression in the st.number_input component where typing decimal values was problematic due to immediate formatting overriding user input. The fix ensures that while the input field is focused, raw user input is displayed instead of the formatted value, preventing keystrokes from being overridden.
Key changes:
- Modified the display logic to show unformatted values during user input
- Added comprehensive e2e test coverage for decimal input via keyboard
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
frontend/lib/src/components/widgets/NumberInput/NumberInput.tsx |
Introduces displayValue logic to bypass formatting during focus, preventing input interference |
e2e_playwright/st_number_input_test.py |
Adds e2e test to verify decimal input functionality works correctly |
| ) | ||
|
|
||
|
|
||
| def test_number_input_typing_decimal_via_keyboard(app: Page): |
There was a problem hiding this comment.
question: Just to double-check, this test would have failed before this fix, correct?
There was a problem hiding this comment.
Yep, I tested it manually -> it would have failed in the current state.
## Describe your changes Fix a regression that makes it very hard to type in decimal numbers into `st.number_input`. ## GitHub Issue Link (if applicable) - Closes #12349 ## Testing Plan - Added e2e test that uses type and a decimal number. --- **Contribution License Agreement** By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.
## Describe your changes Manually reverts the logic from these two changes to prevent some unexpected issues with NumberInput usage: - #12351 - #11885 ## GitHub Issue Link (if applicable) - Closes #12526 - Maybe related to #12465 ## Testing Plan - Added e2e test for one of the regression, the rest should be covered well with the existing tests. --- **Contribution License Agreement** By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license. --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Describe your changes
Fix a regression that makes it very hard to type in decimal numbers into
st.number_input.GitHub Issue Link (if applicable)
Testing Plan
Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.