diff --git a/packages/tab/index.tsx b/packages/tab/index.tsx index 767062dfa..0d63cf797 100644 --- a/packages/tab/index.tsx +++ b/packages/tab/index.tsx @@ -72,6 +72,7 @@ export default class Tab extends React.Component { 'aria-selected': false, 'activateIndicator': false, 'previousIndicatorClientRect': this.props.previousIndicatorClientRect, + 'tabIndex': -1, }; componentDidMount() { diff --git a/test/unit/tab/index.test.tsx b/test/unit/tab/index.test.tsx index 6ecfc32c1..5787a66d5 100644 --- a/test/unit/tab/index.test.tsx +++ b/test/unit/tab/index.test.tsx @@ -29,6 +29,16 @@ test('adds the active class if props.active is true on mount', () => { assert.isTrue(wrapper.hasClass('mdc-tab--active')); }); +test('sets the tabIndex to 0 if props.active is true on mount', () => { + const wrapper = shallow(); + assert.equal(wrapper.prop('tabIndex'), 0); +}); + +test('sets the tabIndex to -1 if props.active is false on mount', () => { + const wrapper = shallow(); + assert.equal(wrapper.prop('tabIndex'), -1); +}); + test('adds a class from state.classList', () => { const wrapper = shallow(); wrapper.setState({classList: new Set(['test-class'])});