Skip to content

Commit

Permalink
fix: tooltip not showing on accordion summary
Browse files Browse the repository at this point in the history
  • Loading branch information
Vojimirovich committed Oct 31, 2024
1 parent b1a61bd commit bc4b736
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,7 @@ export function Constitution({ constitution, metadata }: ConstitutionProps) {
},
a: (props) => {
if (props.href && props.href.startsWith("#")) {
return (
<TOCLink
{...props}
callback={onTOCLinkClick}
disabled={props.className.includes("toc-link-h2")}
/>
);
return <TOCLink {...props} callback={onTOCLinkClick} />;
}
return <a {...props} />;
}
Expand Down
4 changes: 1 addition & 3 deletions frontend/src/components/organisms/Constitution/TOCLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ interface Props {
href: string;
children: React.ReactNode;
callback: () => void;
disabled: boolean;
}
/**
* TOCLink Component
Expand All @@ -19,7 +18,7 @@ interface Props {
* @param {Function} props.callback - A callback function to be executed after the link is clicked.
*/

const TOCLink = ({ href, children, callback, disabled }: Props) => {
const TOCLink = ({ href, children, callback }: Props) => {
const [isActive, setIsActive] = useState(false);
const [isTruncated, setIsTruncated] = useState(false);
const linkRef = useRef<HTMLAnchorElement>(null);
Expand Down Expand Up @@ -76,7 +75,6 @@ const TOCLink = ({ href, children, callback, disabled }: Props) => {
style={{
color: customPalette.textBlack,
textDecoration: "none",
pointerEvents: disabled ? "none" : undefined,
maxWidth: "260px",
whiteSpace: "nowrap",
overflow: "hidden",
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/components/organisms/Constitution/TOCNested.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ export const TocNested = ({ headings }) => {
},
"&.Mui-expanded": {
backgroundColor: customPalette.accordionBg
},
"& a": {
"&:active": {
pointerEvents: "none" // disables the href activation on click but keep tooltip showing
}
}
}}
>
Expand Down

0 comments on commit bc4b736

Please sign in to comment.