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

Fix unexpected behaviour of the cursor #2927

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

rodasarede
Copy link

Closes: #2612

Issue: The cursor position in the input field was not maintained correctly after inserting an invalid character in the middle of the word, causing the cursor to jump to the end of that text.

Changes:
State Management: Updated the onChange method to ensure the cursor position is preserved after state updates.
Cursor Position Handling: Added logic to save and restore the cursor position using setTimeout, addressing the issue of cursor jumps.
Debounce Logic: Adjusted the method to handle debounce actions correctly in sequence with state updates.

Additional:
Added tests to verify that the cursor position remains correctly positioned after typing invalid characters in the input field.

Contributor Checklist

  • I have broken down my PR scope into the following TODO tasks
  • I have run the tests locally and they passed. (refer to testing section in contributing)
  • I have added tests, or extended existing tests, to cover any new features or bugs fixed in this PR

When inserting a non valid character in the middle of a pattern,
the cursor instantly jumps to the end of the word,
instead of staying in that position.
Added also some case tests.
@gvwilson gvwilson self-assigned this Jul 25, 2024
@gvwilson gvwilson removed their assignment Aug 2, 2024
@gvwilson gvwilson added the feature something new label Aug 13, 2024
@gvwilson gvwilson changed the title Fixes #2612: unexpected behaviour of the cursor Fix unexpected behaviour of the cursor Aug 13, 2024
@gvwilson gvwilson added P2 considered for next cycle fix fixes something broken and removed feature something new labels Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix fixes something broken P2 considered for next cycle
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cursor jumps to end of dcc.Input when pattern is not satisfied
3 participants