diff --git a/packages/orbit-components/src/Card/CardSection/index.tsx b/packages/orbit-components/src/Card/CardSection/index.tsx index e649b4880f..2aa7cd0bf0 100644 --- a/packages/orbit-components/src/Card/CardSection/index.tsx +++ b/packages/orbit-components/src/Card/CardSection/index.tsx @@ -8,14 +8,8 @@ import { ELEMENT_OPTIONS } from "../../Heading/consts"; import type { Props } from "./types"; import Header from "../components/Header"; import Expandable from "./components/Expandable"; -import handleKeyDown from "../../utils/handleKeyDown"; import Stack from "../../Stack"; - -const Actions = ({ actions }) => ( - - {actions} - -); +import handleKeyDown from "../../utils/handleKeyDown"; export default function CardSection({ title, @@ -31,6 +25,7 @@ export default function CardSection({ onExpand, dataTest, actions, + ariaLabel, }: Props) { const [opened, setOpened] = React.useState(initialExpanded); @@ -58,26 +53,20 @@ export default function CardSection({ return ( // Needs to capture bubbled click events from the - {actions && } + {actions && ( + + {actions} + + )} )} {(title != null || header != null) && !expandable && ( -
-
- {actions && } +
+ {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */} +
+
+
)} {children && expandable && (
-
+ {/* {onClick && opened && onClickWrapper()} */} + {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */} +
{children}
@@ -133,11 +153,20 @@ export default function CardSection({ )} {children && !expandable && ( + // eslint-disable-next-line jsx-a11y/no-static-element-interactions
{children}
diff --git a/packages/orbit-components/src/Card/CardSection/types.d.ts b/packages/orbit-components/src/Card/CardSection/types.d.ts index dc9c419c83..d35da4a69a 100644 --- a/packages/orbit-components/src/Card/CardSection/types.d.ts +++ b/packages/orbit-components/src/Card/CardSection/types.d.ts @@ -29,6 +29,7 @@ interface CardProps extends Common.Globals { readonly onExpand?: Common.Callback; readonly onClick?: Common.Callback; readonly header?: React.ReactNode; + readonly ariaLabel?: string; } export type Props = CardProps & ExpandableConditionalProps;