Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions site/src/pages/Forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ var Forms = React.createClass({
<div className="code-example__example">
<Form>
<FormField label="Email address" htmlFor="basic-form-input-email">
<FormInput autofocus type="email" placeholder="Enter email" name="basic-form-input-email" />
<FormInput autoFocus type="email" placeholder="Enter email" name="basic-form-input-email" />
</FormField>
<FormField label="Password" htmlFor="basic-form-input-password">
<FormInput type="password" placeholder="Password" name="basic-form-input-password" />
Expand All @@ -143,7 +143,7 @@ var Forms = React.createClass({
{`
<Form>
<FormField label="Email address" htmlFor="basic-form-input-email">
<FormInput autofocus type="email" placeholder="Enter email" name="basic-form-input-email" />
<FormInput autoFocus type="email" placeholder="Enter email" name="basic-form-input-email" />
</FormField>
<FormField label="Password" htmlFor="basic-form-input-password">
<FormInput type="password" placeholder="Password" name="basic-form-input-password" />
Expand Down
5 changes: 1 addition & 4 deletions src/components/Checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const Checkbox = React.createClass({
propTypes: {
className: React.PropTypes.string,
disabled: React.PropTypes.bool,
autofocus: React.PropTypes.bool,
autoFocus: React.PropTypes.bool,
indeterminate: React.PropTypes.bool,
inline: React.PropTypes.bool,
label: React.PropTypes.string,
Expand All @@ -15,9 +15,6 @@ const Checkbox = React.createClass({
},

componentDidMount () {
if (this.props.autofocus) {
this.refs.target.focus();
}
this.setIndeterminate(this.props.indeterminate);
},

Expand Down
14 changes: 2 additions & 12 deletions src/components/FormInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var classNames = require('classnames');
module.exports = React.createClass({
displayName: 'FormInput',
propTypes: {
autofocus: React.PropTypes.bool,
autoFocus: React.PropTypes.bool,
className: React.PropTypes.string,
disabled: React.PropTypes.bool,
href: React.PropTypes.string,
Expand All @@ -28,16 +28,6 @@ module.exports = React.createClass({
};
},

componentDidMount () {
if (this.props.autofocus) {
this.focus();
}
},

focus() {
this.refs.input.focus();
},

render() {
// classes
let className = classNames(
Expand All @@ -49,7 +39,7 @@ module.exports = React.createClass({
(this.props.size ? ('FormInput--' + this.props.size) : null),
this.props.className
);
let props = { ...this.props, className, ref: 'input' };
let props = { ...this.props, className };
let Element = 'input';
if (this.props.noedit && this.props.href) {
Element = 'a';
Expand Down