Skip to content

Commit

Permalink
[added] autoFocus support
Browse files Browse the repository at this point in the history
  • Loading branch information
jquense committed Sep 15, 2015
1 parent 51e4915 commit 180bc31
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/Combobox.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ let propTypes = {

onSelect: React.PropTypes.func,

autoFocus: React.PropTypes.bool,
disabled: CustomPropTypes.disabled,
readOnly: CustomPropTypes.readOnly,

Expand Down Expand Up @@ -202,6 +203,7 @@ var ComboBox = React.createClass({
suggest={suggest}
name={name}
role='combobox'
autoFocus={this.props.autoFocus}
aria-owns={listID}
aria-busy={!!busy}
aria-autocomplete={completeType}
Expand Down
2 changes: 2 additions & 0 deletions src/DateTimePicker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Expand Down Expand Up @@ -184,6 +185,7 @@ var DateTimePicker = React.createClass({
id={inputID}
tabIndex={tabIndex || 0}
role='combobox'
autoFocus={this.props.autoFocus}
aria-labelledby={ariaLabelledby}
aria-expanded={!!open}
aria-busy={!!busy}
Expand Down
7 changes: 5 additions & 2 deletions src/Multiselect.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ var propTypes = {

placeholder: React.PropTypes.string,

autoFocus: React.PropTypes.bool,
disabled: CustomPropTypes.disabled.acceptsArray,

readOnly: CustomPropTypes.readOnly.acceptsArray,
Expand Down Expand Up @@ -118,7 +119,8 @@ var Multiselect = React.createClass({
getInitialState(){
var { data, value, valueField, searchTerm } = this.props
, dataItems = splat(value).map( item => dataItem(data, item, valueField))
, data = this.process(data, dataItems, searchTerm)

data = this.process(data, dataItems, searchTerm)

return {
focusedTag: null,
Expand Down Expand Up @@ -215,7 +217,7 @@ var Multiselect = React.createClass({
ref='status'
id={instanceId(this, '__notify')}
role="status"
className='sr-only'
className='rw-sr'
aria-live='assertive'
aria-atomic="true"
aria-relevant="additions removals text"
Expand Down Expand Up @@ -248,6 +250,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) : '')
Expand Down
2 changes: 2 additions & 0 deletions src/NumberPicker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ let propTypes = {

parse: React.PropTypes.func,

autoFocus: React.PropTypes.bool,
disabled: CustomPropTypes.disabled,
readOnly: CustomPropTypes.readOnly,

Expand Down Expand Up @@ -145,6 +146,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 }
Expand Down

0 comments on commit 180bc31

Please sign in to comment.