Skip to content
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

Handle more edge cases when setting the user's cursor after auto-formatting an input #1284

Open
seancolsen opened this issue Apr 14, 2022 · 1 comment
Labels
help wanted Community contributors can implement this ready Ready for implementation type: enhancement New feature or request work: frontend Related to frontend code in the mathesar_ui directory
Milestone

Comments

@seancolsen
Copy link
Contributor

seancolsen commented Apr 14, 2022

Reproduce

Note: I'm using the │ character here to denote a user's cursor -- not to represent an actual text character.

  1. In Storybook, open the NumberInput component
  2. Enter the number "1,000,000"
  3. Place your cursor before the last zero: "1,000,00│0"
  4. Press Backspace, turning the input into "1,000,0│0"
  5. Expect the input to be reformatted as "100,00│0"
  6. Observe the input to be reformatted as "100,000│" (the value is correct, but the cursor is in the wrong place)

Notes

  • In Cursor position in FormattedInput #1257 we added a function getCursorPositionAfterReformat which determines the cursor position. Fixing this issue will require modifying the logic within that function.

  • That function has a unit test with a number of test cases already written but commented out because they do not pass.

  • The reproduction steps above correspond to the following test case:

    [  '1,000,00'  , 7                , '100,000'    , 6 ]
@seancolsen seancolsen added ready Ready for implementation type: enhancement New feature or request work: frontend Related to frontend code in the mathesar_ui directory labels Apr 14, 2022
@seancolsen seancolsen added this to the [Beta] Better Editing Experience milestone Apr 14, 2022
@seancolsen seancolsen changed the title Handle more cases within getCursorPositionAfterReformat Handle more edge cases when setting the user's cursor after auto-formatting an input Apr 14, 2022
@seancolsen

This comment was marked as outdated.

@kgodey kgodey added the help wanted Community contributors can implement this label Apr 14, 2022
@kgodey kgodey modified the milestones: [Beta] Better Editing Experience, High Priority Jun 2, 2022
@github-actions github-actions bot added the stale label Feb 4, 2023
@seancolsen seancolsen removed the stale label Dec 5, 2023
@mathesar-foundation mathesar-foundation deleted a comment from github-actions bot Jan 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Community contributors can implement this ready Ready for implementation type: enhancement New feature or request work: frontend Related to frontend code in the mathesar_ui directory
Projects
No open projects
Development

No branches or pull requests

2 participants