Skip to content

Commit

Permalink
fix(OverflowMenu): allow users to set focusTrap to false
Browse files Browse the repository at this point in the history
  • Loading branch information
tw15egan committed Feb 23, 2022
1 parent f711831 commit 4f7f6fb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2420,6 +2420,7 @@ exports[`DataTable should render 1`] = `
className="bx--toolbar-action bx--overflow-menu"
direction="bottom"
flipped={true}
focusTrap={true}
iconDescription="Settings"
innerRef={null}
light={false}
Expand Down Expand Up @@ -3436,6 +3437,7 @@ exports[`DataTable sticky header should render 1`] = `
className="bx--toolbar-action bx--overflow-menu"
direction="bottom"
flipped={true}
focusTrap={true}
iconDescription="Settings"
innerRef={null}
light={false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ exports[`DataTable.TableToolbarMenu should render 1`] = `
className="custom-class bx--toolbar-action bx--overflow-menu"
direction="bottom"
flipped={true}
focusTrap={true}
iconDescription="Add"
innerRef={null}
light={false}
Expand Down
9 changes: 8 additions & 1 deletion packages/react/src/components/OverflowMenu/OverflowMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ class OverflowMenu extends Component {
*/
flipped: PropTypes.bool,

/**
* Enable or disable focus trap behavior
*/
focusTrap: PropTypes.bool,

/**
* The CSS class for the icon.
*/
Expand Down Expand Up @@ -228,6 +233,7 @@ class OverflowMenu extends Component {
open: false,
direction: DIRECTION_BOTTOM,
flipped: false,
focusTrap: true,
renderIcon: OverflowMenuVertical16,
onClick: () => {},
onKeyDown: () => {},
Expand Down Expand Up @@ -455,6 +461,7 @@ class OverflowMenu extends Component {
iconDescription,
direction,
flipped,
focusTrap,
menuOffset,
menuOffsetFlip,
iconClass,
Expand Down Expand Up @@ -522,7 +529,7 @@ class OverflowMenu extends Component {

const wrappedMenuBody = (
<FloatingMenu
focusTrap
focusTrap={focusTrap}
triggerRef={this._triggerRef}
menuDirection={direction}
menuOffset={flipped ? menuOffsetFlip : menuOffset}
Expand Down

0 comments on commit 4f7f6fb

Please sign in to comment.