From 44818fd8ea6e33c52068d70b5daa7f38974cb9ad Mon Sep 17 00:00:00 2001 From: jquense Date: Tue, 15 Sep 2015 12:09:16 +0300 Subject: [PATCH] [added] autoFocus support --- src/Combobox.jsx | 2 ++ src/DateTimePicker.jsx | 2 ++ src/Multiselect.jsx | 10 ++++++---- src/NumberPicker.jsx | 2 ++ 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Combobox.jsx b/src/Combobox.jsx index d36729079..882004897 100644 --- a/src/Combobox.jsx +++ b/src/Combobox.jsx @@ -40,6 +40,7 @@ let propTypes = { onSelect: React.PropTypes.func, + autoFocus: React.PropTypes.bool, disabled: CustomPropTypes.disabled, readOnly: CustomPropTypes.readOnly, autoFocus: React.PropTypes.bool, @@ -204,6 +205,7 @@ var ComboBox = React.createClass({ suggest={suggest} name={name} role='combobox' + autoFocus={this.props.autoFocus} aria-owns={listID} aria-busy={!!busy} aria-autocomplete={completeType} diff --git a/src/DateTimePicker.jsx b/src/DateTimePicker.jsx index f13bc7f44..fcadbdf51 100644 --- a/src/DateTimePicker.jsx +++ b/src/DateTimePicker.jsx @@ -63,6 +63,7 @@ let propTypes = { initialView: React.PropTypes.oneOf(viewEnum), finalView: React.PropTypes.oneOf(viewEnum), + autoFocus: React.PropTypes.bool, disabled: CustomPropTypes.disabled, readOnly: CustomPropTypes.readOnly, autoFocus: React.PropTypes.bool, @@ -186,6 +187,7 @@ var DateTimePicker = React.createClass({ autoFocus={autoFocus} tabIndex={tabIndex || 0} role='combobox' + autoFocus={this.props.autoFocus} aria-labelledby={ariaLabelledby} aria-expanded={!!open} aria-busy={!!busy} diff --git a/src/Multiselect.jsx b/src/Multiselect.jsx index 769516375..38813321c 100644 --- a/src/Multiselect.jsx +++ b/src/Multiselect.jsx @@ -59,9 +59,10 @@ var propTypes = { placeholder: React.PropTypes.string, - disabled: CustomPropTypes.disabled.acceptsArray, - readOnly: CustomPropTypes.readOnly.acceptsArray, - autoFocus: React.PropTypes.bool, + autoFocus: React.PropTypes.bool, + disabled: CustomPropTypes.disabled.acceptsArray, + readOnly: CustomPropTypes.readOnly.acceptsArray, + messages: React.PropTypes.shape({ open: CustomPropTypes.message, @@ -120,7 +121,7 @@ var Multiselect = React.createClass({ getInitialState(){ var { data, value, valueField, searchTerm } = this.props , dataItems = splat(value).map( item => dataItem(data, item, valueField)) - , processedData = this.process(this.props.data, dataItems, searchTerm) + , processedData = this.process(data, dataItems, searchTerm) return { focusedTag: null, @@ -251,6 +252,7 @@ var Multiselect = React.createClass({ role='listbox' aria-expanded={open} aria-busy={!!busy} + autoFocus={this.props.autoFocus} aria-owns={listID + ' ' + instanceId(this, '__notify') + (shouldRenderTags ? (' ' + tagsID) : '') diff --git a/src/NumberPicker.jsx b/src/NumberPicker.jsx index 8d4868514..a8039e5e6 100644 --- a/src/NumberPicker.jsx +++ b/src/NumberPicker.jsx @@ -39,6 +39,7 @@ let propTypes = { parse: React.PropTypes.func, + autoFocus: React.PropTypes.bool, disabled: CustomPropTypes.disabled, readOnly: CustomPropTypes.readOnly, autoFocus: React.PropTypes.bool, @@ -153,6 +154,7 @@ let NumberPicker = React.createClass({ name={this.props.name} role='spinbutton' min={this.props.min} + autoFocus={this.props.autoFocus} aria-valuenow={val} aria-valuemin={isFinite(this.props.min) ? this.props.min : null } aria-valuemax={isFinite(this.props.max) ? this.props.max : null }