The reason for the bug was: clicking on the area blurred the search
input. vue-slect relies on this event to close the dropdown.
Since the click happend inside the dropdown, it did not
close (which is correct). Though now the search input was blurred
already, so clicking outside of the dropdown had no effect. Be
preventing event propagation, the input does not get blurred anymore
when clicking inside the dropdown and everything still works.
For a few reasons:
- event.preventDefault() for the Enter key (to stop it from submitting
the form when you select an item) is only effective if it's a keydown
event.
- Using keydown for up/down navigation means you can hold them down to
rapidly scroll through a lot of items.
- Keydown events make the UX feel more responsive, and is consistent
with how most apps/operating systems handle key presses.
* allow to disable options with selectable function
* add simple spec for new selectable option
* Prevent non-selectable options from being keyboard navigatable
* make sure selected tracked value is an option if possible
Before this case did not work correctly:
- Select was rendered with *no* options, but *with* a saved value
- Options were fetched by ajax and options prop was updated
- Reduce function if passed
What happens without this commit is that the selected tracked value
simply was the raw reduced value (previously saved). Which means that
displaying a label for example does not work if the label comes from the
unreduced option.
This commit makes sure that the internal tracked value is checked
against all options not only once the select is created but additionally
when options change.
* remove useless keys
- first key was always undefined
- second key was always the index which is not usefull at all since it
changes based on the order
* add test for setting value after option changed
* correctly react to value property changes if tracking internally
fixes sagalbot#855, sagalbot#842
* add getOptionKey prop
* yarn upgrade doc
* add getOptionKey api doc and fix links
* yarn upgrade
* do not use key on slot
* fix label spec