Skip to content

Allow setting custom overScroll #4703

Closed

Description

@amaau

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.

Activity

  1. ebonow commented on Oct 21, 2021

    @ebonow
    Collaborator

    @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 menuListRef and focusedOptionRef were 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.

  2. Repository owner locked and limited conversation to collaborators on Oct 31, 2022
  3. converted this issue into a discussion #5443 on Oct 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions