diff --git a/README.md b/README.md index 245643b..8c374d6 100755 --- a/README.md +++ b/README.md @@ -198,6 +198,10 @@ DatePicker component. Renders as a [React-Bootstrap InputGroup](https://react-bo * **Optional** * **Type:** `React.Component` * **Example:** `` + * `tabIndex` - The tabIndex specifies the tab order of the input element. If a `customControl` is used, this property is passed down to it as well. + * **Optional** + * **Type:** `number` + * **Example:** `2` * **Methods:** diff --git a/example/app.jsx b/example/app.jsx index 463db13..6937dc3 100755 --- a/example/app.jsx +++ b/example/app.jsx @@ -422,6 +422,41 @@ const App = React.createClass({ + + +

Tab Indexes

+ +
+ + + + Third + + The focus will jump here after Second + + + + + Second + + The focus will jump here after First. + + + + + Fourth + + The focus will jump here after Third + + + + + First + + Focus on this element to start! + + + ; } }); diff --git a/src/index.jsx b/src/index.jsx index 29a2744..58f6169 100644 --- a/src/index.jsx +++ b/src/index.jsx @@ -268,7 +268,8 @@ export default React.createClass({ children: React.PropTypes.oneOfType([ React.PropTypes.arrayOf(React.PropTypes.node), React.PropTypes.node - ]) + ]), + tabIndex: React.PropTypes.number }, getDefaultProps() { @@ -612,6 +613,7 @@ export default React.createClass({ className: this.props.className, style: this.props.style, autoComplete: this.props.autoComplete, + tabIndex: this.props.tabIndex }) : ; return + + ; + } + }); + yield new Promise(function(resolve, reject){ + ReactDOM.render(, container, resolve); + }); + const inputElement = document.querySelector("input.form-control"); + TestUtils.Simulate.focus(inputElement); + assert.notEqual(inputElement, null); + assert.equal(inputElement.getAttribute('tabindex'), 101); + ReactDOM.unmountComponentAtNode(container); + })); });