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

fix: prevent browser scroll while scrolling over the tooltip #5414

Merged
merged 4 commits into from
Dec 11, 2023

Conversation

oykuyilmaz
Copy link
Contributor

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.

Copy link

codecov bot commented Dec 6, 2023

Codecov Report

Attention: 5 lines in your changes are missing coverage. Please review.

Comparison is base (e8674fc) 87.58% compared to head (0c19926) 87.58%.
Report is 47 commits behind head on master.

Files Patch % Lines
src/lib/scroll.js 16.66% 5 Missing ⚠️
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     
Flag Coverage Δ
unittests 87.58% <44.44%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -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";
Copy link
Member

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?

Copy link
Contributor Author

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) {
Copy link
Member

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?

@oykuyilmaz oykuyilmaz merged commit c6475c0 into ajaxorg:master Dec 11, 2023
2 of 3 checks passed
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.

2 participants