-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
fix: prevent browser scroll while scrolling over the tooltip #5414
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #5414 +/- ##
=======================================
Coverage 87.58% 87.58%
=======================================
Files 583 584 +1
Lines 46369 46398 +29
Branches 7016 7019 +3
=======================================
+ Hits 40610 40640 +30
+ Misses 5759 5758 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@@ -580,13 +580,20 @@ class Autocomplete { | |||
this.tooltipNode = dom.createElement("div"); | |||
this.tooltipNode.style.margin = 0; | |||
this.tooltipNode.style.pointerEvents = "auto"; | |||
this.tooltipNode.style.overscrollBehavior = "contain"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is for doc-tooltips of autocomplete items, they are also scrollable.
src/tooltip.js
Outdated
el.addEventListener("wheel", function(event) { | ||
event.stopPropagation(); | ||
var contentOverflows = el.scrollHeight > el.clientHeight; | ||
if (!contentOverflows) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use event.target here, rename this function to something like preventParentScroll move to lib and use in both places?
Description of changes:
Prevents browser scroll when a non-scrollable tooltip is open and you scroll on the tooltip.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.