-
Notifications
You must be signed in to change notification settings - Fork 468
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
Cursor jumps to end of input when inputValue is changed when using DataSearch #394
Comments
Hi, I'm able to replicate the issue. We're using downshift in the search components and there is a related closed issue. Will be able to tell better after more investigation. |
@metagrover @siddharthlatest : Do you have any soln or workaround for this issue ? |
Sorry, didn't get any time to dive into this 😅 This issue should help - downshift-js/downshift#217. Open to PRs if you can propose a solution to this 🐱 |
@metagrover @divyanshu013 : I used ReactiveComponent and created a custom input and it solved this issue . But the Reactive component provides only an option to add the query . I am not able to find an option to highlight the fields. Can you pls let me know if there is an option for highlighting the results , similar to using setQuery in reactive component. |
I solved this cursor issue by making some changes in Datasearch component file . I removed some state changes on the field (isOpen) and as I was not using suggestions here , I commented some of the state changes pertaining to it and it worked. |
@Arvind6353 Can you please share your code changes? |
@aeronesto : Just comment out the state changes on isOpen field . And if you are not using suggestions , remove the state change on suggestions field as well . |
@Arvind6353 : I tried to do what you said, with combinations of autosuggest & this.state.isOpen set to true/false, but it didn't solve the cursor issue. I am using @appbaseio/[email protected] |
I solved the cursor issue in DataSearch.js & CategorySearch.js by rotating the order of setState({ currentValue: value }) & setState({ suggestions: [] }). By placing the From DataSearch.js: currentValue state change replaces suggestions state change in
suggestions state change replaces currentValue state change in
|
@aeronesto, would you like to send a PR for this? |
@divyanshu013, sure thing. |
@aeronesto, I am still facing this issue is it resolved? |
Hi @rohit-sourcefuse, it isn't resolved yet. |
@divyanshu013, Thanks for your reply any suggestion on this? |
At the moment you can use |
@rohit-sourcefuse I just submitted the PR to fix this. |
Since the previous setState was called with older currentValue, the re-render in between onInputChange and setValue used to reset the input value and then set it back to the latest value which caused the cursor to jump to the end. Co-authored-by: Deepak Grover <[email protected]>
Available now in v2.8.2 |
Hi ,
I am using Datasearch Component .
Whenever I try to modify the search value (lets say change the middle character) , the cursor position is going to the end of the input . I guess its rerendering every time .
Pls suggest a fix .
I tried the demo sandbox example for datasearch and I face the same issue there .
<DataSearch componentId="searchbox" dataField={["title"]} fieldWeights={[3]} placeholder="Search" autosuggest={false} highlight={true} />
The text was updated successfully, but these errors were encountered: