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

Add preventScroll option #152

Merged
merged 3 commits into from
Oct 20, 2022
Merged

Add preventScroll option #152

merged 3 commits into from
Oct 20, 2022

Conversation

colebemis
Copy link
Contributor

@colebemis colebemis commented Oct 20, 2022

Problem

By default, when focus moves, the browser attempts to scroll the focused element into view. In most cases, this works fine. However, in TreeView (which uses focusZone), this causes an expected jumping if the treeitem that's focused contains a lot of children:

Screen.Recording.2022-10-19.at.7.44.13.PM.mov

https://github.com/github/primer/issues/1432

Solution

This PR adds an preventScroll option to focusZone() that will allow us to fix the unexpected jumping in TreeView.

@changeset-bot
Copy link

changeset-bot bot commented Oct 20, 2022

🦋 Changeset detected

Latest commit: cf1eb60

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/behaviors Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@colebemis colebemis marked this pull request as ready for review October 20, 2022 20:45
@colebemis colebemis requested review from a team and mperrotti October 20, 2022 20:45
Copy link
Contributor

@mperrotti mperrotti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved assuming we’re going to use it in TreeView in a separate PR

@colebemis colebemis merged commit da293fe into main Oct 20, 2022
@colebemis colebemis deleted the prevent-scroll branch October 20, 2022 21:53
@primer-css primer-css mentioned this pull request Oct 20, 2022
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.

3 participants