Skip to content
Merged
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
17 changes: 9 additions & 8 deletions packages/react-core/src/components/Menu/MenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ export interface MenuItemProps extends Omit<React.HTMLProps<HTMLLIElement>, 'onC
itemId?: any;
/** Target navigation link. Should not be used if the flyout prop is defined. */
to?: string;
/** Navigation link target. Only set when the to property is present. If isExternalLink is also passed in, this property will be set to "_blank". */
target?: string;
/** Navigation link relationship. Only set when the to property is present. */
rel?: string;
/** Flag indicating the item has a checkbox */
hasCheckbox?: boolean;
/** Flag indicating whether the item is active */
Expand Down Expand Up @@ -113,6 +117,8 @@ const MenuItemBase: React.FunctionComponent<MenuItemProps> = ({
id,
'aria-label': ariaLabel,
tooltipProps,
rel,
target,
...props
}: MenuItemProps) => {
const {
Expand Down Expand Up @@ -264,7 +270,8 @@ const MenuItemBase: React.FunctionComponent<MenuItemProps> = ({
'aria-disabled': isDisabled || isAriaDisabled ? true : null,
// prevent invalid 'disabled' attribute on <a> tags
disabled: null,
target: isExternalLink ? '_blank' : null
target: isExternalLink ? '_blank' : target,
rel
};
} else if (Component === 'button') {
additionalProps = {
Expand Down Expand Up @@ -428,13 +435,7 @@ const MenuItemBase: React.FunctionComponent<MenuItemProps> = ({
{...(hasCheckbox && { 'aria-label': ariaLabel })}
{...props}
>
{tooltipProps ? (
<Tooltip {...tooltipProps}>
{renderItem}
</Tooltip>
) : (
renderItem
)}
{tooltipProps ? <Tooltip {...tooltipProps}>{renderItem}</Tooltip> : renderItem}
</li>
);
};
Expand Down