-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Fix keyboard navigation scrolling in dropdowns #26358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
timja
merged 3 commits into
jenkinsci:master
from
SalmanDeveloperz:fix-dropdown-keyboard-scroll
Mar 4, 2026
+1
−13
Merged
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whilst this does fix the bug (which is the priority) it is scrolling too early and its a bit jumpy.
Could you investigate if the
isInViewportfunction could be fixed instead? as I assume that was intended to only scroll when needed. (cc @mawinter69 as the author of that change)the
block: centerdoes seem better. When it was anchored to the bottom which is what false does it was good when going down but when going back up it was a bit strange feeling.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I tested with

block: 'nearest'initially, which only scrolls when needed, but it didn't show section headers when wrapping from bottom to top (e.g. selecting "System" didn't show the "Actions" and "System Configuration" header above it).The
isInViewportfunction checks if the element is in the browser window, not the dropdown container. Items scrolled out of view in the dropdown still pass the check because they're technically in the window, so scrolling never triggers.I can fix
isInViewportto check visibility within the dropdown bounds instead. That would keep the "only scroll when needed" behavior while fixing the bug. Want me to go that route?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Give it a go, would be better if it was less jarring, but if we can't get something nicer at least this works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will update to check dropdown container visibility. Testing now !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried fixing
isInViewportto check dropdown container visibility but ran into issues, the dropdown doesn't have a max-height in the DOM, so it sizes to fit all items and visibility checks always pass.The
"nearest"approach scrolls smoothly and only when needed.Minor edge case: section headers don't always show when wrapping bottom to top, but navigation works fine.
Video attached.
dropdown.with.nearest.fix.mp4
Worth committing or should try something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah lets go for nearest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!