File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -148,6 +148,11 @@ class ReactTags extends React.Component {
148
148
}
149
149
}
150
150
151
+ handleTagClick ( i ) {
152
+ this . deleteTag ( i )
153
+ this . input . input . focus ( )
154
+ }
155
+
151
156
addTag ( tag ) {
152
157
if ( tag . disabled ) {
153
158
return
@@ -184,7 +189,7 @@ class ReactTags extends React.Component {
184
189
key = { i }
185
190
tag = { tag }
186
191
classNames = { this . state . classNames }
187
- onDelete = { this . deleteTag . bind ( this , i ) }
192
+ onDelete = { this . handleTagClick . bind ( this , i ) }
188
193
/>
189
194
) )
190
195
Original file line number Diff line number Diff line change @@ -420,6 +420,11 @@ describe('React Tags', () => {
420
420
sinon . assert . calledWith ( props . handleDelete , sinon . match ( 0 ) )
421
421
} )
422
422
423
+ it ( 'moves focus to the input when a tag is removed' , ( ) => {
424
+ click ( $ ( '.react-tags__selected-tag' ) )
425
+ expect ( document . activeElement ) . toEqual ( $ ( 'input' ) )
426
+ } )
427
+
423
428
it ( 'deletes the last selected tag when backspace is pressed and query is empty' , ( ) => {
424
429
type ( '' ) ; key ( 'backspace' )
425
430
You can’t perform that action at this time.
0 commit comments