-
Notifications
You must be signed in to change notification settings - Fork 376
feat(Menu): consumed Penta updates #10089
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
Changes from all commits
c2bef0a
78f447d
3370c90
1b08af1
65ee850
6d8e422
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,8 +3,8 @@ import styles from '@patternfly/react-styles/css/components/Menu/menu'; | |
| import { css } from '@patternfly/react-styles'; | ||
| import StarIcon from '@patternfly/react-icons/dist/esm/icons/star-icon'; | ||
| import { MenuContext, MenuItemContext } from './MenuContext'; | ||
|
|
||
| export interface MenuItemActionProps extends Omit<React.HTMLProps<HTMLButtonElement>, 'type' | 'ref'> { | ||
| import { Button } from '../Button'; | ||
| export interface MenuItemActionProps extends React.HTMLProps<HTMLDivElement> { | ||
| /** Additional classes added to the action button */ | ||
| className?: string; | ||
| /** The action icon to use */ | ||
|
|
@@ -24,7 +24,7 @@ export interface MenuItemActionProps extends Omit<React.HTMLProps<HTMLButtonElem | |
| } | ||
|
|
||
| const MenuItemActionBase: React.FunctionComponent<MenuItemActionProps> = ({ | ||
| className = '', | ||
| className, | ||
| icon, | ||
| onClick, | ||
| 'aria-label': ariaLabel, | ||
|
|
@@ -45,24 +45,27 @@ const MenuItemActionBase: React.FunctionComponent<MenuItemActionProps> = ({ | |
| onActionClick && onActionClick(event, itemId, actionId); | ||
| }; | ||
| return ( | ||
| <button | ||
| <div | ||
| className={css( | ||
| styles.menuItemAction, | ||
| isFavorited !== null && 'pf-m-favorite', | ||
| isFavorited && styles.modifiers.favorited, | ||
| className | ||
| )} | ||
| aria-label={ariaLabel} | ||
| onClick={onClickButton} | ||
| {...((isDisabled === true || isDisabledContext === true) && { disabled: true })} | ||
| ref={innerRef} | ||
| tabIndex={-1} | ||
| {...props} | ||
| > | ||
| <span className={css(styles.menuItemActionIcon)}> | ||
| <Button | ||
| aria-label={ariaLabel} | ||
| onClick={onClickButton} | ||
| ref={innerRef} | ||
| role="menuitem" | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should help resolve an aXe error that is related to #9968. This also matches the Core markup. That said, it'd be worth looking into an alternative to making each button inside a menu a |
||
| variant="plain" | ||
| tabIndex={-1} | ||
| isDisabled={isDisabled || isDisabledContext} | ||
| > | ||
| {icon === 'favorites' || isFavorited !== null ? <StarIcon aria-hidden /> : icon} | ||
| </span> | ||
| </button> | ||
| </Button> | ||
| </div> | ||
| ); | ||
| }} | ||
| </MenuItemContext.Consumer> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥳