Skip to content

Commit ae68f93

Browse files
committed
[change] Remove label markup
As discussed in reactjs#89
1 parent 3cffb47 commit ae68f93

File tree

5 files changed

+12
-15
lines changed

5 files changed

+12
-15
lines changed

examples/async-data/app.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@ let App = React.createClass({
2424
attempt to autocomplete the first one.
2525
</p>
2626

27+
<label htmlFor="async-autocomplete">
28+
Choose a US state
29+
</label>
2730
<Autocomplete
28-
labelText="Choose a state from the US"
29-
inputProps={{name: "US state"}}
31+
inputProps={{ id: 'async-autocomplete' }}
3032
ref="autocomplete"
3133
value={this.state.value}
3234
items={this.state.unitedStates}

examples/custom-menu/app.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ let App = React.createClass({
2121
look as well as the rendering of it. In this case we put headers for each
2222
letter of the alphabet.
2323
</p>
24+
<label htmlFor="custom-autocomplete">
25+
Choose a US state
26+
</label>
2427
<Autocomplete
2528
value={this.state.value}
26-
labelText="Choose a state from the US"
27-
inputProps={{name: "US state"}}
29+
inputProps={{ id: 'custom-autocomplete' }}
2830
items={this.state.unitedStates}
2931
getItemValue={(item) => item.name}
3032
onSelect={value => this.setState({ value, unitedStates: [] }) }

examples/static-data/app.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ let App = React.createClass({
1616
so <code>Autocomplete</code> has methods baked in to help.
1717
</p>
1818

19+
<label htmlFor="static-autocomplete">
20+
Choose a US state
21+
</label>
1922
<Autocomplete
2023
value={this.state.value}
21-
labelText="Choose a state from the US"
22-
inputProps={{name: "US state"}}
24+
inputProps={{ id: 'static-autocomplete' }}
2325
items={getStates()}
2426
getItemValue={(item) => item.name}
2527
shouldItemRender={matchStateToTerm}

lib/Autocomplete.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
const React = require('react')
2-
const lodash = require('lodash')
32
const scrollIntoView = require('dom-scroll-into-view')
43

54
let _debugStates = []
@@ -14,7 +13,6 @@ let Autocomplete = React.createClass({
1413
renderItem: React.PropTypes.func.isRequired,
1514
menuStyle: React.PropTypes.object,
1615
inputProps: React.PropTypes.object,
17-
labelText: React.PropTypes.string,
1816
wrapperProps: React.PropTypes.object,
1917
wrapperStyle: React.PropTypes.object
2018
},
@@ -27,7 +25,6 @@ let Autocomplete = React.createClass({
2725
display: 'inline-block'
2826
},
2927
inputProps: {},
30-
labelText: '',
3128
onChange () {},
3229
onSelect (value, item) {},
3330
renderMenu (items, value, style) {
@@ -55,7 +52,6 @@ let Autocomplete = React.createClass({
5552
},
5653

5754
componentWillMount () {
58-
this.id = lodash.uniqueId('autocomplete-');
5955
this._ignoreBlur = false
6056
this._performAutoCompleteOnUpdate = false
6157
this._performAutoCompleteOnKeyUp = false
@@ -315,9 +311,6 @@ let Autocomplete = React.createClass({
315311
}
316312
return (
317313
<div style={{...this.props.wrapperStyle}} {...this.props.wrapperProps}>
318-
<label htmlFor={this.id} ref="label">
319-
{this.props.labelText}
320-
</label>
321314
<input
322315
{...this.props.inputProps}
323316
role="combobox"
@@ -330,7 +323,6 @@ let Autocomplete = React.createClass({
330323
onKeyUp={(event) => this.handleKeyUp(event)}
331324
onClick={this.handleInputClick}
332325
value={this.props.value}
333-
id={this.id}
334326
/>
335327
{this.state.isOpen && this.renderMenu()}
336328
{this.props.debug && (

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
"dependencies": {
4949
"babel-preset-es2015": "^6.5.0",
5050
"dom-scroll-into-view": "1.0.1",
51-
"lodash": "^4.5.0",
5251
"react": "^0.14.7",
5352
"react-dom": "^0.14.7"
5453
}

0 commit comments

Comments
 (0)