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 ability to specify custom DOM element for scrollHide scroll events #291

Closed

Conversation

chriscain
Copy link

Just started using react-tooltip this week, really awesome library - thank you guys!

Currently, scrollHide just looks for scrollEvents on the window. This works well 99% of the time, but if a page has custom scroll containers, the window never actually sees any of those scroll events, as they're not fired on the window.

This PR just adds a way to plug in a custom selector to replace the window - I don't believe it fixes every problem of #248, but it should act as an easy workaround for situations like @philraj was having here.

I haven't been following the project closely, so I hope this is the proper way to contribute. Thanks!

`window` works in most cases, but for tooltips rendered within
larger elements that contain `overflow: scroll`, the scroll events
don’t fire on the window. This allows specifying a custom selector
to get a different scroll container other than the window
@sivagao
Copy link
Contributor

sivagao commented Sep 18, 2017

Useful PR

@glf256
Copy link

glf256 commented Oct 17, 2017

For anyone running into this issue, setting the isCapture prop will allow the window scroll listener to catch scroll events on a div when using overflow: scroll. (Supported in IE9+).

@aronhelser
Copy link
Collaborator

Confirmed that setting isCapture fixes the issue. Perhaps we should make isCapture the default?

aronhelser added a commit that referenced this pull request Apr 17, 2018
use data-is-capture so the scroll events are paid attention to.

fix #248, re #291
@aronhelser
Copy link
Collaborator

Handled by isCapture.

@aronhelser aronhelser closed this Jan 30, 2020
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.

4 participants