Add autoFocus to wizard input fields

This commit is contained in:
Vesa Luusua 2017-05-11 18:49:22 +03:00
parent e418bb1590
commit aa538a2eae
8 changed files with 12 additions and 3 deletions

View file

@ -45,7 +45,7 @@ const LocationPredictionsList = props => {
);
};
const { shape, string, arrayOf, func, any, number } = PropTypes;
const { bool, shape, string, arrayOf, func, any, number } = PropTypes;
LocationPredictionsList.defaultProps = { highlightedIndex: null };
@ -269,7 +269,7 @@ class LocationAutocompleteInput extends Component {
});
}
render() {
const { className, placeholder, input } = this.props;
const { autoFocus, className, placeholder, input } = this.props;
const { name, onFocus, onBlur } = input;
const { search, predictions } = currentValue(this.props);
@ -300,6 +300,7 @@ class LocationAutocompleteInput extends Component {
className={classNames(css.input, className)}
type="search"
autoComplete="off"
autoFocus={autoFocus}
placeholder={placeholder}
name={name}
value={search}
@ -325,9 +326,10 @@ class LocationAutocompleteInput extends Component {
}
}
LocationAutocompleteInput.defaultProps = { className: '', placeholder: '' };
LocationAutocompleteInput.defaultProps = { autoFocus: false, className: '', placeholder: '' };
LocationAutocompleteInput.propTypes = {
autoFocus: bool,
className: string,
placeholder: string,
input: shape({

View file

@ -57,6 +57,7 @@ export class EditListingDescriptionFormComponent extends Component {
return (
<form onSubmit={handleSubmit}>
<Field
autoFocus
name="title"
label={titleMessage}
placeholder={titlePlaceholderMessage}

View file

@ -9,6 +9,7 @@ exports[`EditListingDescriptionForm matches snapshot 1`] = `
Name of your sauna
</label>
<input
autoFocus={true}
className=""
name="title"
onBlur={[Function]}

View file

@ -41,6 +41,7 @@ export class EditListingLocationFormComponent extends Component {
return (
<form onSubmit={handleSubmit}>
<Field
autoFocus
name="location"
label={titleRequiredMessage}
format={null}

View file

@ -2,6 +2,7 @@ exports[`EditListingLocationForm matches snapshot 1`] = `
<form
onSubmit={[Function]}>
<Field
autoFocus={true}
component={[Function]}
format={null}
label="EditListingLocationForm.location"

View file

@ -38,6 +38,7 @@ export class EditListingPricingFormComponent extends Component {
<form onSubmit={handleSubmit}>
<div className={css.priceWrapper}>
<Field
autoFocus
name="price"
component={this.EnhancedCurrencyInput}
currencyConfig={config.currencyConfig}

View file

@ -6,6 +6,7 @@ exports[`EditListingPricingForm matches snapshot 1`] = `
<div
className="">
<input
autoFocus={true}
className=""
label={null}
onBlur={[Function]}

View file

@ -5,6 +5,7 @@ exports[`SearchForm matches snapshot 1`] = `
className={undefined}>
<input
autoComplete="off"
autoFocus={false}
className=""
name="location"
onBlur={[Function]}