diff --git a/components/article/ToolPicker.tsx b/components/article/ToolPicker.tsx index decd54c5438c..6596b8b26d93 100644 --- a/components/article/ToolPicker.tsx +++ b/components/article/ToolPicker.tsx @@ -17,6 +17,14 @@ function showToolSpecificContent(tool: string, supportedTools: Array) { .filter((el) => supportedTools.some((tool) => el.classList.contains(tool))) .forEach((el) => { el.style.display = el.classList.contains(tool) ? '' : 'none' + + // hack: special handling for minitoc links -- we can't pass the tool classes + // directly to the Primer NavList.Item generated
  • , it gets passed down + // to the child . So if we find an that has the tool class and its + // parent is an
  • , we hide/unhide that element as well. + if (el.tagName === 'A' && el.parentElement && el.parentElement.tagName === 'LI') { + el.parentElement.style.display = el.classList.contains(tool) ? '' : 'none' + } }) // find all tool-specific *inline* elements and hide or show as appropriate