day8 / re-com

A ClojureScript library of reusable components for Reagent
https://re-com.day8.com.au
MIT License
797 stars 146 forks source link

Hides suggestions on blur; Added option to change model on every keystroke #168

Closed orolle closed 5 years ago

orolle commented 6 years ago

Hides suggestions when input is blurred. Solution uses got-suggestions []. This causes at on focus the suggestions to be empty. Tried to work a round this issue by using :displaying-suggestion? true / false on focus / blur but caused that suggestions did not update on change of keystroke anymore.

Added option :immediate-model-update? to update model on every keystroke (similar to change-on-blur? but no changes to model if mouse is over suggestions). This allows the user to enter new values via input or select existing value via suggestion + click (not like change-on-blur? which a mouse over suggestions leads to changes in his text entered).

ESC hides suggestions instead of resetting. User can enter his text, press ESC to hide suggestions and press tap to get to the next input text, without needing the mouse to blur.

On empty input ("") searches. User gets default options shown without typing anything. User need to enter a character and deletes it again to see suggestions on empty input.

Added documentation text to re-demo.

Gregg8 commented 5 years ago

Thanks for your PR :-) Merged. Note: We updated the argument docs and the demo notes.