@@ -94,7 +94,13 @@ export default {
94
94
} else {
95
95
popupVisible = ! ! props . defaultPopupVisible ;
96
96
}
97
+ ALL_HANDLERS . forEach ( h => {
98
+ this [ `fire${ h } ` ] = e => {
99
+ this . fireEvents ( h , e ) ;
100
+ } ;
101
+ } ) ;
97
102
return {
103
+ prevPopupVisible : popupVisible ,
98
104
sPopupVisible : popupVisible ,
99
105
point : null ,
100
106
} ;
@@ -103,6 +109,7 @@ export default {
103
109
popupVisible ( val ) {
104
110
if ( val !== undefined ) {
105
111
this . sPopupVisible = val ;
112
+ this . prevPopupVisible = val ;
106
113
}
107
114
} ,
108
115
sPopupVisible ( val ) {
@@ -113,14 +120,6 @@ export default {
113
120
} ) ;
114
121
} ,
115
122
} ,
116
-
117
- beforeCreate ( ) {
118
- ALL_HANDLERS . forEach ( h => {
119
- this [ `fire${ h } ` ] = e => {
120
- this . fireEvents ( h , e ) ;
121
- } ;
122
- } ) ;
123
- } ,
124
123
deactivated ( ) {
125
124
this . setPopupVisible ( false ) ;
126
125
} ,
@@ -286,7 +285,15 @@ export default {
286
285
}
287
286
this . preClickTime = 0 ;
288
287
this . preTouchTime = 0 ;
289
- if ( event && event . preventDefault ) {
288
+ // Only prevent default when all the action is click.
289
+ // https://github.com/ant-design/ant-design/issues/17043
290
+ // https://github.com/ant-design/ant-design/issues/17291
291
+ if (
292
+ this . isClickToShow ( ) &&
293
+ ( this . isClickToHide ( ) || this . isBlurToHide ( ) ) &&
294
+ event &&
295
+ event . preventDefault
296
+ ) {
290
297
event . preventDefault ( ) ;
291
298
}
292
299
if ( event && event . domEvent ) {
@@ -446,19 +453,20 @@ export default {
446
453
} ,
447
454
448
455
setPopupVisible ( sPopupVisible , event ) {
449
- const { alignPoint } = this . $props ;
456
+ const { alignPoint, sPopupVisible : prevPopupVisible } = this ;
450
457
this . clearDelayTimer ( ) ;
451
- if ( this . $data . sPopupVisible !== sPopupVisible ) {
458
+ if ( prevPopupVisible !== sPopupVisible ) {
452
459
if ( ! hasProp ( this , 'popupVisible' ) ) {
453
460
this . setState ( {
454
461
sPopupVisible,
462
+ prevPopupVisible,
455
463
} ) ;
456
464
}
457
465
const listeners = getListeners ( this ) ;
458
466
listeners . popupVisibleChange && listeners . popupVisibleChange ( sPopupVisible ) ;
459
467
}
460
468
// Always record the point position since mouseEnterDelay will delay the show
461
- if ( sPopupVisible && alignPoint && event ) {
469
+ if ( alignPoint && event ) {
462
470
this . setPoint ( event ) ;
463
471
}
464
472
} ,
0 commit comments