Skip to content
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

Adding optional scrollOnFocus prop #32

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jefffriesen
Copy link

Clicking into the select box automatically scrolls the page if the bottom of the select box drops below the viewport. This happens for select boxes that have a lot of options.

I created a prop called scrollOnFocus that defaults to true which behaves just like it did before this commit. Setting scrollOnFocus to false prevents .focus() of the menu, which prevents window from scrolling. There may be reasons for wanting to keep focus (such as accessibility) so the this is opt-in only and non-breaking.

Btw, setting event.preventDefault() in handleFocus did not work for me. That's why I allowed disabling of focus.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant