Closed
Description
When navigating by keyboard, the focused option is scrolled into view.
But for some reason it scrolls a little bit extra, causing the items in the menu to be offset from the top or bottom menu's bounds.
I guess it is an aesthetical decision, but it's a strange default - in many designs a menu's height is some multiple of the options' heights, so that the options don't get cut off in the middle.
In any case I think it should be up to the user to set the amount of overscroll, for my use case I just set the overScroll variable inside the scrollIntoView function to 0.
Another feature that would solve a similar problem is a setting to force the onwheel scroll to jump in integer multiples of option heights.
Metadata
Metadata
Assignees
Labels
No labels
Activity
ebonow commentedon Oct 21, 2021
@amaau ,
I believe this was likely chosen as a default to differentiate that there are more options.
tbh, I have always wondered why the focused item is scrolled to the bottom of the menu as opposed to the top as this seems counter-intuitive to me to how scrolling to an element normally behaves.
I think this is a valid feature request to have more control over the scroll behavior likely in the same realm as having control over what option should be focused (if any).
It likely could be addressed more easily if the
menuListRefandfocusedOptionRefwere provided in the onMenuOpen though there is some consideration that would need to be put into the rendering of the component as there is already timing issues with having access to the ref before it is populated.Or this could be handled independently if the scrollIntoView util function which is used, was exposed as a prop similar to several other built-in methods.