File tree 4 files changed +3
-23
lines changed
4 files changed +3
-23
lines changed Original file line number Diff line number Diff line change @@ -70,7 +70,6 @@ React.render(<App />, document.getElementById('app'))
70
70
- [ ` tags ` ] ( #tags-optional )
71
71
- [ ` suggestions ` ] ( #suggestions-optional )
72
72
- [ ` placeholder ` ] ( #placeholder-optional )
73
- - [ ` autofocus ` ] ( #autofocus-optional )
74
73
- [ ` autoresize ` ] ( #autoresize-optional )
75
74
- [ ` delimiters ` ] ( #delimiters-optional )
76
75
- [ ` delimiterChars ` ] ( #delimitersChars-optional )
@@ -113,10 +112,6 @@ const suggestions = [
113
112
114
113
The placeholder string shown for the input. Default: ` 'Add new tag' ` .
115
114
116
- #### autofocus (optional)
117
-
118
- Boolean parameter to control whether the text-input should be autofocused on mount. Default: ` true ` .
119
-
120
115
#### autoresize (optional)
121
116
122
117
Boolean parameter to control whether the text-input should be automatically resized to fit its value. Default: ` true ` .
Original file line number Diff line number Diff line change @@ -30,10 +30,6 @@ class Input extends React.Component {
30
30
this . copyInputStyles ( )
31
31
this . updateInputWidth ( )
32
32
}
33
-
34
- if ( this . props . autofocus ) {
35
- this . input . focus ( )
36
- }
37
33
}
38
34
39
35
componentDidUpdate ( prevProps ) {
Original file line number Diff line number Diff line change @@ -178,7 +178,6 @@ class ReactTags extends React.Component {
178
178
< Input { ...this . state }
179
179
ref = { ( c ) => { this . input = c } }
180
180
listboxId = { listboxId }
181
- autofocus = { this . props . autofocus }
182
181
autoresize = { this . props . autoresize }
183
182
expandable = { expandable }
184
183
placeholder = { this . props . placeholder } />
@@ -199,7 +198,6 @@ ReactTags.defaultProps = {
199
198
tags : [ ] ,
200
199
placeholder : 'Add new tag' ,
201
200
suggestions : [ ] ,
202
- autofocus : true ,
203
201
autoresize : true ,
204
202
delimiters : [ KEYS . TAB , KEYS . ENTER ] ,
205
203
delimiterChars : [ ] ,
@@ -214,7 +212,6 @@ ReactTags.propTypes = {
214
212
tags : PropTypes . arrayOf ( PropTypes . object ) ,
215
213
placeholder : PropTypes . string ,
216
214
suggestions : PropTypes . arrayOf ( PropTypes . object ) ,
217
- autofocus : PropTypes . bool ,
218
215
autoresize : PropTypes . bool ,
219
216
delimiters : PropTypes . arrayOf ( PropTypes . number ) ,
220
217
delimiterChars : PropTypes . arrayOf ( PropTypes . string ) ,
Original file line number Diff line number Diff line change @@ -50,6 +50,8 @@ function $$ (selector) {
50
50
}
51
51
52
52
function type ( value ) {
53
+ $ ( 'input' ) . focus ( )
54
+
53
55
value . split ( '' ) . forEach ( ( char ) => {
54
56
key ( char )
55
57
$ ( 'input' ) . value += char
@@ -94,16 +96,6 @@ describe('React Tags', () => {
94
96
expect ( $ ( 'input' ) . placeholder ) . toEqual ( 'Please enter a tag' )
95
97
} )
96
98
97
- it ( 'autofocuses on the input' , ( ) => {
98
- createInstance ( { autofocus : true } )
99
- expect ( document . activeElement ) . toEqual ( $ ( 'input' ) )
100
- } )
101
-
102
- it ( 'does not autofocus on the input' , ( ) => {
103
- createInstance ( { autofocus : false } )
104
- expect ( document . activeElement ) . not . toEqual ( $ ( 'input' ) )
105
- } )
106
-
107
99
it ( 'updates state when suggestions list is expanded' , ( ) => {
108
100
createInstance ( )
109
101
@@ -131,7 +123,7 @@ describe('React Tags', () => {
131
123
} )
132
124
133
125
it ( 'calls focus and blur callbacks when provided' , ( ) => {
134
- createInstance ( { autofocus : false } )
126
+ createInstance ( )
135
127
136
128
TestUtils . Simulate . focus ( $ ( 'input' ) )
137
129
sinon . assert . calledOnce ( props . handleFocus )
You can’t perform that action at this time.
0 commit comments