Fix labeled select enter key error - #18684
Conversation
|
🔄 Auto-Retry Failed Run The Tests workflow failed for the commits below and has been automatically retried.
|
…ledselect-console-error
|
|
||
| let option = vm.filteredOptions[vm.typeAheadPointer]; | ||
|
|
||
| if (!option) { |
There was a problem hiding this comment.
I found one issue and I believe it's related to this section here. Things that shouldn't be selectable are now selectable via the keyboard (not the mouse)
pr18684-stale-pointer.mp4
There was a problem hiding this comment.
The recording is very interesting! I'm not able to type in the authentication field with or without my change. Could you give me the exact steps to get to that point?
There was a problem hiding this comment.
oh right! I didn't have enough items on the list, thanks for catching this will address it.
There was a problem hiding this comment.
done, @codyrancher thanks for the review and helping to reproduce the problem
…ledselect-console-error
codyrancher
left a comment
There was a problem hiding this comment.
It looks like your fix does work and it improves things so I don't want to hold this PR up.
While testing your fix I did notice one more related issue but it's present in master as well so it wasn't introduced by this change. If you'd like to fix it here feel free but I'm fine if you'd just like to merge this.
If you type in the labels starting worth the exact wording they're selectable via pressing enter as well.
enter-select.mp4
I don't think we'd need a new issue for this, I'll work on it |

Summary
Fixes #17951
Occurred changes and/or fixed issues
TypeError: Cannot read properties of undefined (reading 'value')thrown when pressing Enter in aLabeledSelectdropdown.Technical notes summary
When a search yields no results the selected option is
undefined. Added null guards invue-select-overrides.jsandLabeledSelect.vueto handle this safely. Unit tests added to cover theundefinedcase and normal selection behaviour.Areas or cases that should be tested
LabeledSelectdropdown (e.g. Namespace selector, any form select field).no error should appear in the console and the dropdown should behave normally.
Areas which could experience regressions
LabeledSelect— especially those with searchable/filterable option lists.Screenshot/Video
entrkey.mov
Checklist
Admin,Standard UserandUser Base