diff --git a/.changeset/fix-metabar-tooltip-clipping.md b/.changeset/fix-metabar-tooltip-clipping.md new file mode 100644 index 000000000..ebcc811ba --- /dev/null +++ b/.changeset/fix-metabar-tooltip-clipping.md @@ -0,0 +1,5 @@ +--- +'@doc-kit/generator-react': patch +--- + +Fix stability badge tooltips being cut off in the MetaBar's table of contents diff --git a/packages/react/src/html/ui/components/MetaBar/index.module.css b/packages/react/src/html/ui/components/MetaBar/index.module.css index 0f3163eec..eafe74268 100644 --- a/packages/react/src/html/ui/components/MetaBar/index.module.css +++ b/packages/react/src/html/ui/components/MetaBar/index.module.css @@ -9,3 +9,30 @@ display: inline-block; margin-left: 0.25rem; } + +/* + * The MetaBar's list scrolls on its own (`overflow-y: auto`), which also clips + * anything that overflows it horizontally. The stability tooltip is centred on + * its badge and can be wider than the space left beside it, so it was cut off. + * + * Anchor the tooltip to the whole table-of-contents row instead, and keep it + * no wider than that row, so it always fits inside the MetaBar. + */ +li:has(> a > .badge) { + position: relative; +} + +.badge[data-tooltip] { + position: static; +} + +.badge[data-tooltip]::after { + left: 0; + max-width: 100%; + translate: none; +} + +/* The arrow would point at the middle of the row, not at the badge */ +.badge[data-tooltip]::before { + display: none; +}