From ded7578ca3a683c7e840eb2b7f6a4d6bbe0f5e74 Mon Sep 17 00:00:00 2001 From: Katie McFaul Date: Wed, 21 Jun 2023 12:52:43 -0400 Subject: [PATCH 1/3] feat(MenuItem): allow target and rel on links --- .../react-core/src/components/Menu/MenuItem.tsx | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/react-core/src/components/Menu/MenuItem.tsx b/packages/react-core/src/components/Menu/MenuItem.tsx index 6791897b237..830890fe3d5 100644 --- a/packages/react-core/src/components/Menu/MenuItem.tsx +++ b/packages/react-core/src/components/Menu/MenuItem.tsx @@ -25,6 +25,10 @@ export interface MenuItemProps extends Omit, '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. */ + 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 */ @@ -113,6 +117,8 @@ const MenuItemBase: React.FunctionComponent = ({ id, 'aria-label': ariaLabel, tooltipProps, + rel, + target, ...props }: MenuItemProps) => { const { @@ -264,7 +270,8 @@ const MenuItemBase: React.FunctionComponent = ({ 'aria-disabled': isDisabled || isAriaDisabled ? true : null, // prevent invalid 'disabled' attribute on tags disabled: null, - target: isExternalLink ? '_blank' : null + target: isExternalLink ? '_blank' : target, + rel }; } else if (Component === 'button') { additionalProps = { @@ -428,13 +435,7 @@ const MenuItemBase: React.FunctionComponent = ({ {...(hasCheckbox && { 'aria-label': ariaLabel })} {...props} > - {tooltipProps ? ( - - {renderItem} - - ) : ( - renderItem - )} + {tooltipProps ? {renderItem} : renderItem} ); }; From ace3c41addd31411c623e5dd6f9cb062f8da3177 Mon Sep 17 00:00:00 2001 From: Katie McFaul Date: Mon, 10 Jul 2023 10:42:47 -0400 Subject: [PATCH 2/3] update desc --- packages/react-core/src/components/Menu/MenuItem.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-core/src/components/Menu/MenuItem.tsx b/packages/react-core/src/components/Menu/MenuItem.tsx index 830890fe3d5..8cc19938105 100644 --- a/packages/react-core/src/components/Menu/MenuItem.tsx +++ b/packages/react-core/src/components/Menu/MenuItem.tsx @@ -27,7 +27,7 @@ export interface MenuItemProps extends Omit, 'onC to?: string; /** Navigation link target. Only set when the to property is present. */ target?: string; - /** Navigation link relationship. Only set when the to property is present. */ + /** Navigation link relationship. Only set when the to property is present. If isExternalLink is also passed in, this property will be set to "_blank". */ rel?: string; /** Flag indicating the item has a checkbox */ hasCheckbox?: boolean; From 7b5e193b59afb550cafdcee1fa489072385d38ad Mon Sep 17 00:00:00 2001 From: Katie McFaul Date: Mon, 10 Jul 2023 14:00:11 -0400 Subject: [PATCH 3/3] move desc to right prop --- packages/react-core/src/components/Menu/MenuItem.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-core/src/components/Menu/MenuItem.tsx b/packages/react-core/src/components/Menu/MenuItem.tsx index 8cc19938105..bc8e94b7da7 100644 --- a/packages/react-core/src/components/Menu/MenuItem.tsx +++ b/packages/react-core/src/components/Menu/MenuItem.tsx @@ -25,9 +25,9 @@ export interface MenuItemProps extends Omit, '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. */ + /** 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. If isExternalLink is also passed in, this property will be set to "_blank". */ + /** Navigation link relationship. Only set when the to property is present. */ rel?: string; /** Flag indicating the item has a checkbox */ hasCheckbox?: boolean;