import React from 'react'; import { Button, KeyTypes } from '@patternfly/react-core'; const handleKeydown = (event: React.KeyboardEvent) => { const { key } = event; const isEnterKey: boolean = key === KeyTypes.Enter; const isEnterOrSpaceKey: boolean = isEnterKey || key === KeyTypes.Space; if (isEnterOrSpaceKey) { event.preventDefault(); alert(`${isEnterKey ? 'Enter' : 'Space'} key default behavior stopped by onKeyDown`); } }; export const ButtonInlineSpanLink: React.FunctionComponent = () => (

Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Sed hendrerit nisi in cursus maximus. Ut malesuada nisi turpis, in condimentum velit elementum non.

Note that using a span as a button does not fire the onclick event for Enter or Space keys.
Pressing the Enter or Space keys on the inline link as span above demonstrates this by triggering an alert.

);