File tree 1 file changed +7
-1
lines changed
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -108,7 +108,6 @@ module.exports = create-class do
108
108
class-name : class-name-from-object do
109
109
\react-selectize : 1
110
110
" #{ @ props .theme } " : 1
111
- \control-wrapper : 1
112
111
\root-node : 1
113
112
" #{ @ props .class-name } " : 1
114
113
disabled : @ props .disabled
@@ -130,12 +129,19 @@ module.exports = create-class do
130
129
div do
131
130
class-name : \react-selectize-control
132
131
ref : \control
132
+
133
+ # using click would cause a flicker because:
134
+ # 1: on mouse down, the focus will blur from the search field causing the dropdown menu to close
135
+ # 2: on mouse up, the click event will be fired and open the dropdown menu again
136
+ # on mouse down, we have to cancel the event otherwise the search field would cause the same problem above
133
137
on-mouse-down : (e ) ~>
134
138
do ~>
135
139
<~ @ props .on-anchor-change last @ props .values
136
140
<~ @ on -open-change true
137
141
@ highlight-and-focus!
138
142
143
+ # avoid cancelling the event when the dropdown is already open
144
+ # as this would block selection of text in the search field
139
145
if ! @ props .open
140
146
cancel-event e
141
147
You can’t perform that action at this time.
0 commit comments