import * as React from "react"; import { cx } from "@emotion/css"; import { getAllFocusableChildNodes } from "../../utilities/getFocusableChildNodes"; import { padding } from "../../shared/styles/styleUtils"; import { flex } from "../../shared/styles/styleUtils/layout/flexbox"; import Icon from "../../icon/components/Icon"; import { SystemIcons } from "../../icons/dist/system-icons-enum"; import { fillWidth, accordionTitleInteractive } from "../style"; export interface AccordionItemTitleInnerProps { isExpanded?: boolean; isInteractive?: boolean; children: React.ReactNode; ["data-cy"]?: string; } const AccordionItemTitleInner = ({ children, isExpanded, isInteractive, "data-cy": dataCy = "accordionItemTitleInner" }: AccordionItemTitleInnerProps) => { const contentRef = React.useRef(null); React.useEffect(() => { const allFocusable: HTMLElement[] = contentRef.current ? getAllFocusableChildNodes(contentRef.current) : []; if (!isInteractive) { return; } allFocusable.forEach(el => { el.setAttribute("style", "pointer-events: all;"); }); }, [contentRef, isInteractive]); return ( {children} ); }; export default AccordionItemTitleInner;