@@ -197,12 +197,8 @@ const Selector: React.RefForwardingComponent<RefSelectorProps, SelectorProps> =
197
197
pastedTextRef . current = value ;
198
198
} ;
199
199
200
- const onMouseDown : React . MouseEventHandler < HTMLElement > = event => {
201
- const inputMouseDown = getInputMouseDown ( ) ;
202
- if ( event . target !== inputRef . current ) {
203
- if ( ! inputMouseDown ) {
204
- event . preventDefault ( ) ;
205
- }
200
+ const onClick = ( { target } ) => {
201
+ if ( target !== inputRef . current ) {
206
202
// Should focus input if click the selector
207
203
const isIE = ( document . body . style as any ) . msTouchAction !== undefined ;
208
204
if ( isIE ) {
@@ -213,6 +209,13 @@ const Selector: React.RefForwardingComponent<RefSelectorProps, SelectorProps> =
213
209
inputRef . current . focus ( ) ;
214
210
}
215
211
}
212
+ } ;
213
+
214
+ const onMouseDown : React . MouseEventHandler < HTMLElement > = event => {
215
+ const inputMouseDown = getInputMouseDown ( ) ;
216
+ if ( event . target !== inputRef . current && ! inputMouseDown ) {
217
+ event . preventDefault ( ) ;
218
+ }
216
219
217
220
if ( ( mode !== 'combobox' && ( ! showSearch || ! inputMouseDown ) ) || ! open ) {
218
221
if ( open ) {
@@ -240,7 +243,12 @@ const Selector: React.RefForwardingComponent<RefSelectorProps, SelectorProps> =
240
243
) ;
241
244
242
245
return (
243
- < div ref = { domRef } className = { `${ prefixCls } -selector` } onMouseDown = { onMouseDown } >
246
+ < div
247
+ ref = { domRef }
248
+ className = { `${ prefixCls } -selector` }
249
+ onClick = { onClick }
250
+ onMouseDown = { onMouseDown }
251
+ >
244
252
{ selectNode }
245
253
</ div >
246
254
) ;
0 commit comments