Skip to content

Commit

Permalink
fix(OverflowMenu): remove default tabindex and SVG focusable attribute (
Browse files Browse the repository at this point in the history
#6976)

* fix(OverflowMenu): remove default tabindex value

* fix(OverflowMenu): remove `focusable` icon prop

* test(OverflowMenu): remove initial tabindex value check

* chore: update snapshots

Co-authored-by: DAK <40970507+dakahn@users.noreply.github.com>
  • Loading branch information
emyarod and dakahn authored Oct 19, 2020
1 parent b162614 commit 0e7d909
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2439,7 +2439,6 @@ exports[`DataTable should render 1`] = `
}
}
selectorPrimaryFocus="[data-overflow-menu-primary-focus]"
tabIndex={0}
title="Settings"
>
<ClickListener
Expand All @@ -2454,22 +2453,19 @@ exports[`DataTable should render 1`] = `
onClose={[Function]}
onKeyDown={[Function]}
open={false}
tabIndex={0}
title="Settings"
type="button"
>
<ForwardRef(Settings16)
aria-label="Settings"
className="bx--overflow-menu__icon"
focusable="false"
onClick={[Function]}
onKeyDown={[Function]}
>
<Icon
aria-label="Settings"
className="bx--overflow-menu__icon"
fill="currentColor"
focusable="false"
height={16}
onClick={[Function]}
onKeyDown={[Function]}
Expand Down Expand Up @@ -3450,7 +3446,6 @@ exports[`DataTable sticky header should render 1`] = `
}
}
selectorPrimaryFocus="[data-overflow-menu-primary-focus]"
tabIndex={0}
title="Settings"
>
<ClickListener
Expand All @@ -3465,22 +3460,19 @@ exports[`DataTable sticky header should render 1`] = `
onClose={[Function]}
onKeyDown={[Function]}
open={false}
tabIndex={0}
title="Settings"
type="button"
>
<ForwardRef(Settings16)
aria-label="Settings"
className="bx--overflow-menu__icon"
focusable="false"
onClick={[Function]}
onKeyDown={[Function]}
>
<Icon
aria-label="Settings"
className="bx--overflow-menu__icon"
fill="currentColor"
focusable="false"
height={16}
onClick={[Function]}
onKeyDown={[Function]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ exports[`DataTable.TableToolbarMenu should render 1`] = `
}
}
selectorPrimaryFocus="[data-overflow-menu-primary-focus]"
tabIndex={0}
title="Add"
>
<ClickListener
Expand All @@ -61,22 +60,19 @@ exports[`DataTable.TableToolbarMenu should render 1`] = `
onClose={[Function]}
onKeyDown={[Function]}
open={false}
tabIndex={0}
title="Add"
type="button"
>
<ForwardRef(Download16)
aria-label="Add"
className="bx--overflow-menu__icon"
focusable="false"
onClick={[Function]}
onKeyDown={[Function]}
>
<Icon
aria-label="Add"
className="bx--overflow-menu__icon"
fill="currentColor"
focusable="false"
height={16}
onClick={[Function]}
onKeyDown={[Function]}
Expand Down
11 changes: 0 additions & 11 deletions packages/react/src/components/OverflowMenu/OverflowMenu-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,6 @@ describe('OverflowMenu', () => {
).toEqual('uniqueId');
});

it('should apply a tabindex to the menu', () => {
const defaultMenu = mount(
<OverflowMenu>
<div>Child</div>
</OverflowMenu>
).childAt(0);
// Enzyme doesn't seem to allow props() in a forwardRef-wrapped class component
expect(defaultMenu.find('OverflowMenu').instance().props.tabIndex).toBe(
0
);
});
it('should specify light version as expected', () => {
rootWrapper.setProps({ light: true });
expect(rootWrapper.props().light).toEqual(true);
Expand Down
9 changes: 0 additions & 9 deletions packages/react/src/components/OverflowMenu/OverflowMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,6 @@ class OverflowMenu extends Component {
* be focused when the OverflowMenu opens
*/
selectorPrimaryFocus: PropTypes.string,

/**
* The `tabindex` attribute.
*/
tabIndex: PropTypes.number,
};

static defaultProps = {
Expand All @@ -227,7 +222,6 @@ class OverflowMenu extends Component {
onKeyDown: () => {},
onClose: () => {},
onOpen: () => {},
tabIndex: 0,
menuOffset: getMenuOffset,
menuOffsetFlip: getMenuOffset,
light: false,
Expand Down Expand Up @@ -443,7 +437,6 @@ class OverflowMenu extends Component {
render() {
const {
id,
tabIndex,
ariaLabel,
children,
iconDescription,
Expand Down Expand Up @@ -533,7 +526,6 @@ class OverflowMenu extends Component {
onKeyDown: this.handleKeyDown,
className: overflowMenuIconClasses,
'aria-label': iconDescription,
focusable: 'false', // Prevent `<svg>` in trigger icon from getting focus for IE11
};

return (
Expand All @@ -548,7 +540,6 @@ class OverflowMenu extends Component {
onClick={this.handleClick}
aria-label={ariaLabel}
id={id}
tabIndex={tabIndex}
ref={mergeRefs(this._triggerRef, ref)}>
<IconElement {...iconProps}>
{iconDescription && <title>{iconDescription}</title>}
Expand Down

0 comments on commit 0e7d909

Please sign in to comment.