diff --git a/src/TabBarRootNode.js b/src/TabBarRootNode.js index 025a1322..ba2adb2f 100644 --- a/src/TabBarRootNode.js +++ b/src/TabBarRootNode.js @@ -3,13 +3,6 @@ import classnames from 'classnames'; import { getDataAttr } from './utils'; export default class TabBarRootNode extends React.Component { - componentDidUpdate() { - const activeTab = this.props.getRef('activeTab'); - if (activeTab) { - activeTab.focus(); - } - } - getExtraContentStyle = () => { const { tabBarPosition, direction } = this.props; const topOrBottom = tabBarPosition === 'top' || tabBarPosition === 'bottom'; diff --git a/tests/a11y.spec.js b/tests/a11y.spec.js index e3428503..5d26e630 100644 --- a/tests/a11y.spec.js +++ b/tests/a11y.spec.js @@ -66,7 +66,6 @@ describe('', () => { which: KeyCode.RIGHT, }); expect(tabs.at(0).getDOMNode().className).toContain('rc-tabs-tab-active'); - expect(tabs.at(1).getDOMNode().className).not.toContain('rc-tabs-tab-active'); }); it('first tab should be selected by default', () => { @@ -75,16 +74,14 @@ describe('', () => { expect(selectedTab.getDOMNode()).toBe(firstTab.getDOMNode()); }); - it('switching tab via keyboard arrow navigation should move focus to new active tab', () => { + it('switching tab via keyboard arrow navigation should move to new active tab', () => { simulateKeyDown(tabList.getDOMNode(), KeyCode.RIGHT); - const secondTab = tabs.at(1); - expect(document.activeElement).toBe(secondTab.getDOMNode()); + expect(tabs.at(1).getDOMNode().className).toContain('rc-tabs-tab-active'); }); - it('clicking a tab should move focus to this tab', () => { - const thirdTab = tabs.at(2); - thirdTab.simulate('click'); - expect(document.activeElement).toBe(thirdTab.getDOMNode()); + it('clicking a tab should active this tab', () => { + tabs.at(2).simulate('click'); + expect(tabs.at(2).getDOMNode().className).toContain('rc-tabs-tab-active'); }); });