@@ -37,7 +37,9 @@ export default class DateTimePicker extends PureComponent {
37
37
38
38
wrapper = createRef ( ) ;
39
39
40
- widgetWrapper = createRef ( ) ;
40
+ calendarWrapper = createRef ( ) ;
41
+
42
+ clockWrapper = createRef ( ) ;
41
43
42
44
componentDidMount ( ) {
43
45
this . handleOutsideActionListeners ( ) ;
@@ -74,15 +76,16 @@ export default class DateTimePicker extends PureComponent {
74
76
}
75
77
76
78
onOutsideAction = ( event ) => {
77
- const { wrapper, widgetWrapper } = this ;
79
+ const { wrapper, calendarWrapper , clockWrapper } = this ;
78
80
79
81
// Try event.composedPath first to handle clicks inside a Shadow DOM.
80
82
const target = 'composedPath' in event ? event . composedPath ( ) [ 0 ] : event . target ;
81
83
82
84
if (
83
85
wrapper . current &&
84
86
! wrapper . current . contains ( target ) &&
85
- ( ! widgetWrapper . current || ! widgetWrapper . current . contains ( target ) )
87
+ ( ! calendarWrapper . current || ! calendarWrapper . current . contains ( target ) ) &&
88
+ ( ! clockWrapper . current || ! clockWrapper . current . contains ( target ) )
86
89
) {
87
90
this . closeWidgets ( ) ;
88
91
}
@@ -365,7 +368,7 @@ export default class DateTimePicker extends PureComponent {
365
368
366
369
return portalContainer ? (
367
370
createPortal (
368
- < div ref = { this . widgetWrapper } className = { classNames } >
371
+ < div ref = { this . calendarWrapper } className = { classNames } >
369
372
{ calendar }
370
373
</ div > ,
371
374
portalContainer ,
@@ -423,7 +426,7 @@ export default class DateTimePicker extends PureComponent {
423
426
424
427
return portalContainer ? (
425
428
createPortal (
426
- < div ref = { this . widgetWrapper } className = { classNames } >
429
+ < div ref = { this . clockWrapper } className = { classNames } >
427
430
{ clock }
428
431
</ div > ,
429
432
portalContainer ,
0 commit comments