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

Unpredictable 'valueBeforeUpDown' when using keyboard + mouse together #268

Closed
emersonyu opened this issue Oct 14, 2016 · 3 comments
Closed
Labels

Comments

@emersonyu
Copy link

Not sure if this is a bug or intended behavior, but it seems odd to me. You can see it in your codepen here: http://codepen.io/moroshko/pen/PZWbzK

  1. Focus on the input field

  2. Type c, and wait for suggestions to appear

  3. ArrowDown to any option

  4. Mouseover/move over the suggestion list

    Observed behaviour: You should notice the one you have highlighted has the whole word highlighted now, and the input value change as well (but the suggestions don't update to reflect this).

    Expected behaviour: Not quite sure, but I feel like it should behave the same as key up/down and not update the input value. Maybe valueBeforeUpDown should not be updated if it's via mouseevent.

Let me know if you think this is a bug or not, or maybe an unimportant edge case. I am doing some extra stuff on mouseenter/leave of each suggestion, so it's quite noticeable for me.

Caused by a combo of:

onMouseLeave: this.resetFocusedSuggestion,
...
resetFocusedSuggestion = () => { this.props.updateFocusedSuggestion(null, null); };

Since it's null now, it grabs the input value instead of the correct previous value.
const renderSuggestionData = { query: (valueBeforeUpDown || value).trim() };

If onSuggestionFocused is implemented, this could be squashed at the same time.

@moroshko
Copy link
Owner

@emersonyu First of all, thanks a lot for a properly submitted issue. This is already a great contribution to this project!

This is clearly a bug. valueBeforeUpDown should not change to null on mouse leave in this case.

I hope to find time to fix this soon.

@moroshko
Copy link
Owner

This is fixed in v7.0.1 now.

@emersonyu
Copy link
Author

Thanks @moroshko! Will test it out this week and let you know if there are any other issues related to this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants