-
Notifications
You must be signed in to change notification settings - Fork 381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#10289: Cursor position is shifted incorrectly in Localized number field component #10312
Conversation
…lized number field component Description: - fix the jumping cursor to unexpected positions for localized numeric input
…lized number field component Description: - replace logic in updateDidMount to onKeyUp - remove unused comments
…lized number field component Description: - remove unused method in IntlNumberFormControl
Description: - resolve FE failure in unit test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mahmoudadel54
In most cases, the cursor position behaves correctly, except for few these. Kindly check. Thanks!
-
With fractional/decimal digit, on focus field value becomes unformatted
fractional_unformatted.mp4
-
Follow up to above issue, the cursor position is incorrect when deleting fractional digits probably caused by unformatted value
unformatted_cursor_position_incorrect.mp4
These are because this regex which located in NumericInput:
it sees number like: 321.235 as incomplete number @dsuren1 I need more clarifications about the cases this regular expression should handle. |
…lized number field component [resolve review comments] Description: - fix issue of on focus effect in NumericInput
…lized number field component [resolve review comments] Description: - fix FE issue in onKeyDown in IntlNumberFormControl
…lized number field component [resolve review comments] Description: - revert unnecessary change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
Add unit tests for these cases
-
Cursor position shift incorrectly as we type. I didn't see this before previous commit. Kindly check it. Thanks!
incorrect_cursor.mp4
Hi @dsuren1 cursor.issue.working.as.expected.mp4 |
Like I mentioned over chat, it happens when user types the value a little fast. Kindly give it a try like we discussed. Thanks! |
…lized number field component [resolve review comments] Description: - move the fixing logic of cursor position to componentDidUpdate instead of onKeyUp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mahmoudadel54
Before reviewing this new change, I would also like this component to support onKeyUp
function from consuming component in tandem with the changes incorporated for handing cursor
…lized number field component [resolve review comments] Description: - add onKeyUp as a prop into IntlNumberFormControl for any expected future consuming from a parent comp
Done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mahmoudadel54
Rest looks good. Just minor amendments. And still unit tests are missing
…lized number field component [resolve review comments] Description: - add unit test - resolve review comments
@ElenaGallo Kindly test it in DEV and let us know if it's good to be backported. Thanks! |
Test passed, @mahmoudadel54 please backport to 2024.01.xx. Thanks |
…lized number field component (geosolutions-it#10312) * geosolutions-it#10289: Cursor position is shifted incorrectly in Localized number field component Description: - fix the jumping cursor to unexpected positions for localized numeric input * geosolutions-it#10289: Cursor position is shifted incorrectly in Localized number field component Description: - replace logic in updateDidMount to onKeyUp - remove unused comments * geosolutions-it#10289: Cursor position is shifted incorrectly in Localized number field component Description: - remove unused method in IntlNumberFormControl * geosolutions-it#10136: Search for Map CRS coordinates Description: - resolve FE failure in unit test * geosolutions-it#10289: Cursor position is shifted incorrectly in Localized number field component [resolve review comments] Description: - fix issue of on focus effect in NumericInput * geosolutions-it#10289: Cursor position is shifted incorrectly in Localized number field component [resolve review comments] Description: - fix FE issue in onKeyDown in IntlNumberFormControl * geosolutions-it#10289: Cursor position is shifted incorrectly in Localized number field component [resolve review comments] Description: - revert unnecessary change * geosolutions-it#10289: Cursor position is shifted incorrectly in Localized number field component [resolve review comments] Description: - move the fixing logic of cursor position to componentDidUpdate instead of onKeyUp * geosolutions-it#10289: Cursor position is shifted incorrectly in Localized number field component [resolve review comments] Description: - add onKeyUp as a prop into IntlNumberFormControl for any expected future consuming from a parent comp * geosolutions-it#10289: Cursor position is shifted incorrectly in Localized number field component [resolve review comments] Description: - add unit test - resolve review comments
Backport is done ---> #10346 |
…eld component (#10312) (#10346) * #10289: Cursor position is shifted incorrectly in Localized number field component Description: - fix the jumping cursor to unexpected positions for localized numeric input * #10289: Cursor position is shifted incorrectly in Localized number field component Description: - replace logic in updateDidMount to onKeyUp - remove unused comments * #10289: Cursor position is shifted incorrectly in Localized number field component Description: - remove unused method in IntlNumberFormControl * #10136: Search for Map CRS coordinates Description: - resolve FE failure in unit test * #10289: Cursor position is shifted incorrectly in Localized number field component [resolve review comments] Description: - fix issue of on focus effect in NumericInput * #10289: Cursor position is shifted incorrectly in Localized number field component [resolve review comments] Description: - fix FE issue in onKeyDown in IntlNumberFormControl * #10289: Cursor position is shifted incorrectly in Localized number field component [resolve review comments] Description: - revert unnecessary change * #10289: Cursor position is shifted incorrectly in Localized number field component [resolve review comments] Description: - move the fixing logic of cursor position to componentDidUpdate instead of onKeyUp * #10289: Cursor position is shifted incorrectly in Localized number field component [resolve review comments] Description: - add onKeyUp as a prop into IntlNumberFormControl for any expected future consuming from a parent comp * #10289: Cursor position is shifted incorrectly in Localized number field component [resolve review comments] Description: - add unit test - resolve review comments
Description
In this PR, fixing cursor position shifting incorrectly in Localized number field component
Please check if the PR fulfills these requirements
What kind of change does this PR introduce? (check one with "x", remove the others)
Issue
#10289
What is the current behavior?
#10289
What is the new behavior?
For Localized number field component, if user edits/adds/deletes numbers into the input, the cursor will move in a correct way.
Breaking change
Does this PR introduce a breaking change? (check one with "x", remove the other)
Other useful information