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

Extract useScrollBlocker hook from 2U #46

Open
lettertwo opened this issue Feb 27, 2020 · 0 comments
Open

Extract useScrollBlocker hook from 2U #46

lettertwo opened this issue Feb 27, 2020 · 0 comments

Comments

@lettertwo
Copy link
Contributor

Is your feature request related to a problem? Please describe.

In UIs that present 'modal' or 'popover' behavior, there is often scrollable content behind the overlay. If the user performs scrolling input while the modal is displayed, it may cause the underlying content to scroll, causing disorientation and confusion.

2U has a hook that prevents scroll behavior on the document when passed a truthy value. This could be a building block for modal behaviors—a simple solution for an important detail that is easy to overlook.

Describe the solution you'd like

Extract and package 2U's useScrollBlocker hook

Note that, as implemented, this may not be robust enough for general use cases. We may need to consider API for specifying the scrollable element to block, and or for finding the nearest scrollable container to an element.

Describe alternatives you've considered

🤔

Additional context

  • the implementation is probably too naive
  • no docs or tests yet
  • peer dependencies
    • react
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant