Skip to content

Commit

Permalink
chore(OverflowMenuItem): deprecate primaryFocus
Browse files Browse the repository at this point in the history
  • Loading branch information
emyarod committed May 29, 2020
1 parent d544609 commit 0786687
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
13 changes: 2 additions & 11 deletions packages/react/src/components/OverflowMenu/OverflowMenu-story.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,7 @@ storiesOf('OverflowMenu', module)
'basic',
withReadme(OverflowREADME, () => (
<OverflowMenu {...props.menu()}>
<OverflowMenuItem
{...props.menuItem()}
itemText="Option 1"
primaryFocus
/>
<OverflowMenuItem {...props.menuItem()} itemText="Option 1" />
<OverflowMenuItem
{...props.menuItem()}
itemText="Option 2 is an example of a really long string and how we recommend handling this"
Expand Down Expand Up @@ -94,7 +90,6 @@ storiesOf('OverflowMenu', module)
href: 'https://www.ibm.com',
}}
itemText="Option 1"
primaryFocus
/>
<OverflowMenuItem
{...{
Expand Down Expand Up @@ -150,11 +145,7 @@ storiesOf('OverflowMenu', module)
style: { width: 'auto' },
renderIcon: () => <div style={{ padding: '0 1rem' }}>Menu</div>,
}}>
<OverflowMenuItem
{...props.menuItem()}
itemText="Option 1"
primaryFocus
/>
<OverflowMenuItem {...props.menuItem()} itemText="Option 1" />
<OverflowMenuItem
{...props.menuItem()}
itemText="Option 2 is an example of a really long string and how we recommend handling this"
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/OverflowMenu/OverflowMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ class OverflowMenu extends Component {
iconClass,
onClick, // eslint-disable-line
onOpen, // eslint-disable-line
selectorPrimaryFocus, // eslint-disable-line
selectorPrimaryFocus = '[data-floating-menu-primary-focus]', // eslint-disable-line
renderIcon: IconElement,
innerRef: ref,
menuOptionsClass,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import classNames from 'classnames';
import warning from 'warning';
import { settings } from 'carbon-components';
import { match, keys } from '../../internal/keyboard';
import deprecate from '../../prop-types/deprecate.js';

const { prefix } = settings;

Expand Down Expand Up @@ -72,7 +73,13 @@ export default class OverflowMenuItem extends React.Component {
/**
* `true` if this menu item should get focus when the menu gets open.
*/
primaryFocus: PropTypes.bool,
primaryFocus: deprecate(
PropTypes.bool,
'The `primaryFocus` prop has been deprecated as it is no longer used. ' +
'Feel free to remove this prop from <OverflowMenuItem>. This prop will ' +
'be removed in the next major release of `carbon-components-react`. ' +
'Opt for `selectorPrimaryFocus` in `<OverflowMenu>` instead'
),

/**
* `true` if this menu item has long text and requires a browser tooltip
Expand Down Expand Up @@ -120,6 +127,7 @@ export default class OverflowMenuItem extends React.Component {
onClick, // eslint-disable-line
handleOverflowMenuItemFocus, // eslint-disable-line
onKeyDown,
primaryFocus,
wrapperClassName,
requireTitle,
index,
Expand Down Expand Up @@ -163,6 +171,7 @@ export default class OverflowMenuItem extends React.Component {
<li className={overflowMenuItemClasses} role="menuitem">
<TagToUse
{...other}
{...{ 'data-floating-menu-primary-focus': primaryFocus || null }}
href={href}
className={overflowMenuBtnClasses}
disabled={disabled}
Expand Down

0 comments on commit 0786687

Please sign in to comment.