@@ -43,7 +43,8 @@ class ReactTooltip extends Component {
43
43
countTransform : PropTypes . bool ,
44
44
afterShow : PropTypes . func ,
45
45
afterHide : PropTypes . func ,
46
- disable : PropTypes . bool
46
+ disable : PropTypes . bool ,
47
+ scrollHide : PropTypes . bool
47
48
}
48
49
49
50
constructor ( props ) {
@@ -231,6 +232,15 @@ class ReactTooltip extends Component {
231
232
232
233
// If it is focus event or called by ReactTooltip.show, switch to `solid` effect
233
234
const switchToSolid = e instanceof window . FocusEvent || isGlobalCall
235
+
236
+ // if it need to skip adding hide listener to scroll
237
+ let scrollHide = true
238
+ if ( e . currentTarget . getAttribute ( 'data-scroll-hide' ) ) {
239
+ scrollHide = e . currentTarget . getAttribute ( 'data-scroll-hide' ) === 'true'
240
+ } else if ( this . props . scrollHide != null ) {
241
+ scrollHide = this . props . scrollHide
242
+ }
243
+
234
244
this . setState ( {
235
245
placeholder,
236
246
place : e . currentTarget . getAttribute ( 'data-place' ) || this . props . place || 'top' ,
@@ -250,7 +260,7 @@ class ReactTooltip extends Component {
250
260
? e . currentTarget . getAttribute ( 'data-count-transform' ) === 'true'
251
261
: ( this . props . countTransform != null ? this . props . countTransform : true )
252
262
} , ( ) => {
253
- this . addScrollListener ( e )
263
+ if ( scrollHide ) this . addScrollListener ( e )
254
264
this . updateTooltip ( e )
255
265
256
266
if ( getContent && Array . isArray ( getContent ) ) {
0 commit comments