-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Select arrow down and up behaviors with hidden selected option (#…
…2314) # Pull Request ## 🤨 Rationale While doing the integration work of updating the SLE user selector to use dynamic options, a non-ideal behavior became apparent in the case where a user would provide some filter text, filtering out the current selected user (which as our guidance states, requires the option to be present but hidden), and then press `ArrowDown`, and nothing would get selected. This would happen when the selected option was _below_ the other options in DOM order. The two solutions for creating the expected behavior were 1) update the integration code to always put the hidden option at the top of the DOM order, or 2) change the Nimble Select behavior to provide the expected behavior in this case. I opted with 2 because it feels like a gap that any user of the Nimble Select could possibly hit. ## 👩💻 Implementation Now handling the `ArrowDown` and `ArrowUp` cases directly in the key handling code of the `Select`. ## 🧪 Testing Added some unit tests. Manually checked behavior in Angular example app with dynamic options. ## ✅ Checklist <!--- Review the list and put an x in the boxes that apply or ~~strike through~~ around items that don't (along with an explanation). --> - [ ] I have updated the project documentation to reflect my changes or determined no changes are needed. --------- Co-authored-by: Milan Raj <[email protected]>
- Loading branch information
1 parent
bbede1f
commit c3e3478
Showing
3 changed files
with
126 additions
and
1 deletion.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
change/@ni-nimble-components-6be73ddd-262a-4cf8-bc31-ebfba88bf517.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"type": "patch", | ||
"comment": "Update Select arrow down behavior to select first option in dropdown when selected option is visually hidden.", | ||
"packageName": "@ni/nimble-components", | ||
"email": "[email protected]", | ||
"dependentChangeType": "patch" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters