Fix: Scrollable dropdown does not highlight current selection (#4958)#5020
Conversation
Dynamic Loading: - Uses actual vocabulary size from pageInfo.totalElements - Caps at 200 items to prevent loading huge vocabularies - Performance scaled: 50 items (Good UX), 100 items (Acceptable), 200 items (Borderline) Selection Highlighting: - Highlight current value when menu opens (setSelectedIndexToCurrentValue) - Treat 'Clear selection' as index 0, adjust item indices (i+1) - Arrow key navigation respects clear item (totalItems) - Enter selects correct item or clears when index = 0 - Skip disabled items in scrollToSelected - Selected items now highlighted correctly up to position 200# This is the 1st commit message:
594e1bc to
44a3fcd
Compare
|
Hi! Tested this fix via the Type and Language dropdowns, looks good and works as expected. Nice catch on the keyboard navigation to 'Clear selection' too! Also adding backport tags to 8.x and 7.x; after comparing code it looks like this fix should be able to auto backport smoothly. |
tdonohue
left a comment
There was a problem hiding this comment.
👍 Thanks @solomona2003 ! The code looks good to me, and glad to see that @lgeggleston tested it thoroughly
|
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin dspace-7_x
git worktree add -d .worktree/backport-5020-to-dspace-7_x origin/dspace-7_x
cd .worktree/backport-5020-to-dspace-7_x
git switch --create backport-5020-to-dspace-7_x
git cherry-pick -x 44a3fcd7d5808d61caa8af5432487841cb8490b1 |
|
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin dspace-8_x
git worktree add -d .worktree/backport-5020-to-dspace-8_x origin/dspace-8_x
cd .worktree/backport-5020-to-dspace-8_x
git switch --create backport-5020-to-dspace-8_x
git cherry-pick -x 44a3fcd7d5808d61caa8af5432487841cb8490b1 |
|
Successfully created backport PR for |
|
@solomona2003 : We were able to auto-backport this to 9.x. But, the backports to 8.x and 7.x failed. This will need to wait on a volunteer to backport it further. Please let me know if you are interested in backporting this to our Thanks again! |
Description
Fixes #4958
This PR fixes two issues with the scrollable dropdown component:
Changes Made
Selection Highlighting
Dynamic Loading
Testing
Tested with submission forms using Type and Language dropdowns.
Checklist
This checklist provides a reminder of what we are going to look for when reviewing your PR. You do not need to complete this checklist prior creating your PR (draft PRs are always welcome).
However, reviewers may request that you complete any actions in this list if you have not done so. If you are unsure about an item in the checklist, don't hesitate to ask. We're here to help!
mainbranch of code (unless it is a backport or is fixing an issue specific to an older branch).npm run lintnpm run check-circ-deps)package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.