feat(select): add ability to cycle through options with arrow keys when closed#3313
Conversation
7ef1e47 to
bb8ab2e
Compare
jelbourn
left a comment
There was a problem hiding this comment.
LGTM, one small comment. Feel free to add merge_ready when ready.
|
|
||
| // TODO(crisbeto): native selects also cycle through the options with left/right arrows, | ||
| // however the key manager only supports up/down at the moment. | ||
| this._keyManager.onKeydown(event); |
There was a problem hiding this comment.
Add comment like
// Cycle though the select options even when the select is closed,
// matching the behavior of the native select element.73efa57 to
675a08d
Compare
|
Sorry for the delay on this one. Apparently I missed the notification and it also needed some refactoring after the mutli select PR got in. |
| private _selectValue(value: any): MdOption { | ||
| let correspondingOption = this.options.find(option => option.value === value); | ||
| let optionsArray = this.options.toArray(); | ||
| let correspondingOptionIndex = optionsArray.findIndex(option => option.value === value); |
There was a problem hiding this comment.
We can't use findIndex inside of Google (Closure's type definition for array doesn't have it).
@crisbeto ping me when this one ready again
…en closed * Adds the ability for users to select options by focusing on a closed `md-select` and pressing the up/down arrow keys. * Fixes a bug that prevents the selection from going to the first item in a `ListKeyManager`, if there were no previously-selected items. * Adds an extra null check to the `FocusKeyManager` to avoid issues where the focused item is cleared. Fixes angular#2990.
675a08d to
d90b796
Compare
|
Removed the |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
md-selectand pressing the up/down arrow keys.ListKeyManager, if there were no previously-selected items.FocusKeyManagerto avoid issues where the focused item is cleared.Fixes #2990.