@@ -12,7 +12,7 @@ const privates = new WeakMap();
12
12
function bodyNotAllowedToScroll ( document ) {
13
13
if ( typeof document !== 'object' ) return ;
14
14
const body = document . getElementsByTagName ( 'body' ) [ 0 ] ;
15
- if ( ! body . classList . contains ( 'pui-no-scroll' ) ) {
15
+ if ( ! body . classList . contains ( 'pui-no-scroll' ) ) {
16
16
body . classList . add ( 'pui-no-scroll' ) ;
17
17
}
18
18
}
@@ -40,7 +40,8 @@ export class BaseModal extends mixin(React.PureComponent).with(Animation) {
40
40
acquireFocus : true ,
41
41
animation : true ,
42
42
keyboard : true ,
43
- onHide : ( ) => { } ,
43
+ onHide : ( ) => {
44
+ } ,
44
45
getDocument : ( ) => global . document
45
46
} ;
46
47
@@ -59,13 +60,13 @@ export class BaseModal extends mixin(React.PureComponent).with(Animation) {
59
60
}
60
61
61
62
modalClicked = e => {
62
- if ( ! this . dialog ) return ;
63
- if ( this . dialog . contains ( e . target ) ) return ;
63
+ if ( ! this . dialog ) return ;
64
+ if ( this . dialog . contains ( e . target ) ) return ;
64
65
this . props . onHide ( e ) ;
65
66
} ;
66
67
67
68
onKeyDown = e => {
68
- if ( this . props . keyboard && e . keyCode === ESC_KEY ) {
69
+ if ( this . props . keyboard && e . keyCode === ESC_KEY ) {
69
70
this . props . onHide ( e ) ;
70
71
}
71
72
} ;
@@ -115,22 +116,22 @@ export class BaseModal extends mixin(React.PureComponent).with(Animation) {
115
116
116
117
privates . set ( this , { ...privates . get ( this ) , fractionShown} ) ;
117
118
118
- if ( oldFractionShown < 1 && fractionShown === 1 ) {
119
+ if ( oldFractionShown < 1 && fractionShown === 1 ) {
119
120
if ( acquireFocus ) this . focus ( ) ;
120
121
onEntered && onEntered ( ) ;
121
122
}
122
123
123
- if ( oldFractionShown > 0 && fractionShown === 0 ) {
124
+ if ( oldFractionShown > 0 && fractionShown === 0 ) {
124
125
onExited && onExited ( ) ;
125
126
}
126
127
127
- if ( fractionShown === 0 && ! show ) return null ;
128
+ if ( fractionShown === 0 && ! show ) return null ;
128
129
129
130
const props = mergeProps ( modalProps , {
130
131
className : 'modal fade in' ,
131
132
role : 'dialog' ,
132
133
style : { display : 'block' } ,
133
- onClick : this . modalClicked ,
134
+ onMouseDown : this . modalClicked ,
134
135
tabIndex : - 1
135
136
} ) ;
136
137
@@ -144,15 +145,16 @@ export class BaseModal extends mixin(React.PureComponent).with(Animation) {
144
145
return (
145
146
< div className = "modal-wrapper" role = "dialog" >
146
147
< div className = "modal-backdrop fade in" style = { { opacity : fractionShown * 0.8 } } onClick = { onHide } />
147
- < div { ...props } ref = { ref => this . modal = ref } >
148
- < div className = { classnames ( 'modal-dialog' , dialogClassName , { [ modalSizeClass ] : modalSize } ) } style = { dialogStyle } ref = { ref => this . dialog = ref } >
149
- < div className = "modal-content" >
150
- < div className = "modal-header" >
151
- < h3 className = "modal-title em-high" > { title } </ h3 >
152
- < div className = "modal-close" >
153
- < button className = "btn btn-icon" onClick = { onHide } >
154
- < Icon src = "close" />
155
- </ button >
148
+ < div { ...props } ref = { ref => this . modal = ref } >
149
+ < div className = { classnames ( 'modal-dialog' , dialogClassName , { [ modalSizeClass ] : modalSize } ) }
150
+ style = { dialogStyle } ref = { ref => this . dialog = ref } >
151
+ < div className = "modal-content" >
152
+ < div className = "modal-header" >
153
+ < h3 className = "modal-title em-high" > { title } </ h3 >
154
+ < div className = "modal-close" >
155
+ < button className = "btn btn-icon" onClick = { onHide } >
156
+ < Icon src = "close" />
157
+ </ button >
156
158
</ div >
157
159
</ div >
158
160
{ children }
0 commit comments