diff --git a/packages/react-core/src/components/DescriptionList/DescriptionListTermHelpTextButton.tsx b/packages/react-core/src/components/DescriptionList/DescriptionListTermHelpTextButton.tsx index cff5753ad72..d7c8508a94d 100644 --- a/packages/react-core/src/components/DescriptionList/DescriptionListTermHelpTextButton.tsx +++ b/packages/react-core/src/components/DescriptionList/DescriptionListTermHelpTextButton.tsx @@ -13,15 +13,33 @@ export const DescriptionListTermHelpTextButton: React.FunctionComponent ( - - {children} - -); +}: DescriptionListTermHelpTextButtonProps) => { + const helpTextRef = React.createRef(); + + const handleKeys = (event: React.KeyboardEvent) => { + if (!helpTextRef.current || helpTextRef.current !== (event.target as HTMLElement)) { + return; + } + + const key = event.key; + if (key === 'Enter' || key === ' ') { + event.preventDefault(); + helpTextRef.current.click(); + } + }; + + return ( + handleKeys(event)} + {...props} + > + {children} + + ); +}; DescriptionListTermHelpTextButton.displayName = 'DescriptionListTermHelpTextButton';