Commit 7e513cc 1 parent c0f7592 commit 7e513cc Copy full SHA for 7e513cc
File tree 2 files changed +4
-12
lines changed
2 files changed +4
-12
lines changed Original file line number Diff line number Diff line change @@ -507,7 +507,7 @@ class Overlay extends Component {
507
507
const style = {
508
508
overflow : bodyOverflow ,
509
509
} ;
510
- if ( hasScroll ( ) ) {
510
+ if ( bodyPaddingRight !== undefined ) {
511
511
style . paddingRight = bodyPaddingRight ;
512
512
}
513
513
Original file line number Diff line number Diff line change @@ -19,10 +19,6 @@ const { hasClass } = dom;
19
19
const { Popup } = Overlay ;
20
20
const delay = time => new Promise ( resolve => setTimeout ( resolve , time ) ) ;
21
21
const scrollbarWidth = dom . scrollbar ( ) . width ;
22
- const hasScroll = ( ) => {
23
- const doc = document . documentElement ;
24
- return doc . scrollHeight > doc . clientHeight && scrollbarWidth > 0 ;
25
- } ;
26
22
27
23
const render = element => {
28
24
let inc ;
@@ -77,7 +73,7 @@ class OverlayControlDemo extends React.Component {
77
73
const { children, ...others } = this . props ;
78
74
79
75
return (
80
- < div >
76
+ < div style = { { height : '110vh' } } >
81
77
< button
82
78
onClick = { this . onClick }
83
79
ref = { ref => {
@@ -364,16 +360,12 @@ describe('Overlay', () => {
364
360
365
361
simulateEvent . simulate ( btn , 'click' ) ;
366
362
assert ( document . body . style . overflowY === 'hidden' ) ;
367
- if ( hasScroll ( ) ) {
368
- assert ( document . body . style . paddingRight === `${ scrollbarWidth } px` ) ;
369
- }
363
+ assert ( document . body . style . paddingRight === `${ scrollbarWidth } px` ) ;
370
364
371
365
simulateEvent . simulate ( btn , 'click' ) ;
372
366
yield delay ( 500 ) ;
373
367
assert ( ! document . body . style . overflowY ) ;
374
- if ( hasScroll ( ) ) {
375
- assert ( ! document . body . style . paddingRight ) ;
376
- }
368
+ assert ( ! document . body . style . paddingRight ) ;
377
369
} ) ;
378
370
} ) ;
379
371
You can’t perform that action at this time.
0 commit comments