Downshift: Question: Is changing the `inputValue` on the `ArrowUp` and `ArrowDown` event possible?

Created on 26 Feb 2018  路  6Comments  路  Source: downshift-js/downshift

I am trying to make a call to selectedHighlightedItem every time the user changes the highlighted menu item. When I press enter, everything works, but the isOpen changes to false and I don't want the user to press Enter for this anyway. Is there a way to make it work? I would appreciate any help!

question

Most helpful comment

Hey @TheoVitkovskiy!

Thanks for the issue! It'll be much easier for folks here to help you if you provide an example (which is why we have an issue template, please follow that next time). You can start here: http://kcd.im/ds-example

All 6 comments

Hey @TheoVitkovskiy!

Thanks for the issue! It'll be much easier for folks here to help you if you provide an example (which is why we have an issue template, please follow that next time). You can start here: http://kcd.im/ds-example

@TheoVitkovskiy So you want the inputValue and the selectedItem to be set to the value of the highlightedItem at all times? And you want Enter to do nothing?

@austintackaberry Yes, and Enter should just close the Menu and I should be able to make an AJAX call to the server. I read through most of the issues that relate to it and I guess it's possible to modify this behavior.

@TheoVitkovskiy Sounds good! Are you good to close this issue?

@austintackaberry What I meant was that I know that it should be possible but I have no idea how. If it's something too obvious and I'm just missing the point then I can close the issue.

No worries @TheoVitkovskiy :) We're happy to help where we can. This is definitely possible. I think the easiest solution is to use a stateReducer like this: https://codesandbox.io/s/v6yn8j0l03

I think I'll go ahead and close this issue as it's not actionable, but feel free to ask any clarifying questions. :)

Was this page helpful?
0 / 5 - 0 ratings