-
-
Notifications
You must be signed in to change notification settings - Fork 657
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
Wrong cursor placement when choosing from typeahead #4939
Comments
Copying some information from that chat thread: I took a quick look back at the implementation []: we just set the new value for the whole content of the input, and don't do anything to try to control where the cursor is. So that behavior makes sense -- probably what the underlying input code is doing is something like, if your cursor was 80% of the way into the old text, then it gets placed 80% of the way into the [new] text. That's probably about the best that we could hope for the underlying input code to do, given the information we're giving it. To fix this, we'll want to explicitly set where the cursor should be after the autocomplete. I expect there should be an API for that, and we totally have enough information to know what the right position should be, so I think this should be quite doable. |
I would like to work on this issue. |
I looked into this a little bit today. This actually is a problem for emojis as well. For instance:
autocompletes to:
I think the fix here is to have |
Right now in the app, we are getting the current position of the text cursor through the selection variable, but it has no connection with the Input and Autocomplete view component. So one possible solution is to add a selection prop to the Input component. The problem with the solution is that the text cursor sometimes get stuck in a loop after autocomplete happens because of the selection props (see video below). Changes made: link textCursor.mp4 |
When the user inserts a typeahead suggestion that already has some message text after it, the cursor doesn't get placed after the suggestion. Instead, it is placed somewhere in the middle of the typeahead suggestion that was selected. This happens for both @ mentions and stream names (
#foo
).CZO thread
The text was updated successfully, but these errors were encountered: