Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Tabs): remove required role prop #6964

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4936,7 +4936,6 @@ Map {
},
"Tabs" => Object {
"defaultProps": Object {
"role": "navigation",
"selected": 0,
"selectionMode": "automatic",
"type": "default",
Expand All @@ -4963,10 +4962,6 @@ Map {
"onSelectionChange": Object {
"type": "func",
},
"role": Object {
"isRequired": true,
"type": "string",
},
"selected": Object {
"type": "number",
},
Expand Down
10 changes: 0 additions & 10 deletions packages/react/src/components/Tabs/Tabs-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,6 @@ describe('Tabs', () => {
</Tabs>
);

it('renders [role="navigation"] props on wrapping <div> by default', () => {
expect(
wrapper
// TODO: uncomment and replace in next major version
// .find(`.${prefix}--tabs`).props().role
.find(`.${prefix}--tabs--scrollable .${prefix}--tabs--scrollable`)
.props().role
).toEqual('navigation');
});

it('renders [role="tablist"] props on <ul> by default', () => {
expect(wrapper.find('ul').props().role).toEqual('tablist');
});
Expand Down
16 changes: 2 additions & 14 deletions packages/react/src/components/Tabs/Tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default class Tabs extends React.Component {
children: PropTypes.node,

/**
* Provide a className that is applied to the root <nav> component for the
* Provide a className that is applied to the root <div> component for the
* <Tabs>
*/
className: PropTypes.string,
Expand Down Expand Up @@ -58,12 +58,6 @@ export default class Tabs extends React.Component {
*/
onSelectionChange: PropTypes.func,

/**
* By default, this value is "navigation". You can also provide an alternate
* role if it makes sense from the accessibility-side
*/
role: PropTypes.string.isRequired,

/**
* Optionally provide an index for the currently selected <Tab>
*/
Expand All @@ -86,7 +80,6 @@ export default class Tabs extends React.Component {
};

static defaultProps = {
role: 'navigation',
type: 'default',
selected: 0,
selectionMode: 'automatic',
Expand Down Expand Up @@ -332,7 +325,6 @@ export default class Tabs extends React.Component {
render() {
const {
className,
role,
type,
light,
onSelectionChange,
Expand Down Expand Up @@ -427,11 +419,7 @@ export default class Tabs extends React.Component {
return (
// TODO: remove classname and revert div to React Fragment after next major release
<div className={`${prefix}--tabs--scrollable`}>
<div
{...other}
className={classes.tabs}
role={role}
onScroll={this.handleScroll}>
<div {...other} className={classes.tabs} onScroll={this.handleScroll}>
<button
type="button"
className={classes.leftOverflowButtonClasses}
Expand Down