File tree 4 files changed +15
-3
lines changed
4 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ var dom = require("./lib/dom");
14
14
var snippetManager = require ( "./snippets" ) . snippetManager ;
15
15
var config = require ( "./config" ) ;
16
16
var event = require ( "./lib/event" ) ;
17
+ var preventParentScroll = require ( "./lib/scroll" ) . preventParentScroll ;
17
18
18
19
/**
19
20
* @typedef BaseCompletion
@@ -622,13 +623,14 @@ class Autocomplete {
622
623
this . tooltipNode = dom . createElement ( "div" ) ;
623
624
this . tooltipNode . style . margin = "0" ;
624
625
this . tooltipNode . style . pointerEvents = "auto" ;
626
+ this . tooltipNode . style . overscrollBehavior = "contain" ;
625
627
this . tooltipNode . tabIndex = - 1 ;
626
628
this . tooltipNode . onblur = this . blurListener . bind ( this ) ;
627
629
this . tooltipNode . onclick = this . onTooltipClick . bind ( this ) ;
628
630
this . tooltipNode . id = "doc-tooltip" ;
629
631
this . tooltipNode . setAttribute ( "role" , "tooltip" ) ;
630
632
// prevent editor scroll if tooltip is inside an editor
631
- this . tooltipNode . addEventListener ( "wheel" , event . stopPropagation ) ;
633
+ this . tooltipNode . addEventListener ( "wheel" , preventParentScroll ) ;
632
634
}
633
635
var theme = this . editor . renderer . theme ;
634
636
this . tooltipNode . className = "ace_tooltip ace_doc-tooltip " +
Original file line number Diff line number Diff line change @@ -457,6 +457,7 @@ module.exports = `
457
457
pointer-events: none;
458
458
overflow: auto;
459
459
max-width: min(60em, 66vw);
460
+ overscroll-behavior: contain;
460
461
}
461
462
.ace_tooltip pre {
462
463
white-space: pre-wrap;
Original file line number Diff line number Diff line change
1
+ exports . preventParentScroll = function preventParentScroll ( event ) {
2
+ event . stopPropagation ( ) ;
3
+ var target = event . currentTarget ;
4
+ var contentOverflows = target . scrollHeight > target . clientHeight ;
5
+ if ( ! contentOverflows ) {
6
+ event . preventDefault ( ) ;
7
+ }
8
+ } ;
Original file line number Diff line number Diff line change 8
8
var dom = require ( "./lib/dom" ) ;
9
9
var event = require ( "./lib/event" ) ;
10
10
var Range = require ( "./range" ) . Range ;
11
+ var preventParentScroll = require ( "./lib/scroll" ) . preventParentScroll ;
11
12
12
13
var CLASSNAME = "ace_tooltip" ;
13
14
@@ -211,8 +212,8 @@ class HoverTooltip extends Tooltip {
211
212
el . addEventListener ( "blur" , function ( ) {
212
213
if ( ! el . contains ( document . activeElement ) ) this . hide ( ) ;
213
214
} . bind ( this ) ) ;
214
-
215
- el . addEventListener ( "wheel" , event . stopPropagation ) ;
215
+
216
+ el . addEventListener ( "wheel" , preventParentScroll ) ;
216
217
}
217
218
218
219
/**
You can’t perform that action at this time.
0 commit comments