Skip to content

Commit 5d4b38f

Browse files
committed
tabindex/hover cutoff fixes
1 parent b166ef9 commit 5d4b38f

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

src/components/GlossaryTooltip.astro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ definition = definition.split(/\r?\n/)[0];
3030
data-tooltip
3131
data-content={marked.parse(definition)}
3232
class="border-b-2 border-dashed border-accent-600"
33+
tabindex="0"
3334
>{
3435
link ? (
3536
<a href={link}><slot /></a>

src/scripts/footnotes.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ if (footnotes) {
1616
addTooltip(fnref, content.innerHTML);
1717

1818
fnref.classList.add("footnote");
19+
20+
fnref.setAttribute("tabindex", "0");
1921
fnref.removeAttribute("href");
2022
}
2123
}

src/util/tippy.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,10 @@ export function addTooltip(element: HTMLElement, content: string) {
99
interactive: true,
1010
placement: "auto",
1111
arrow: false,
12+
// This is imperfect as it stops you from tabbing into
13+
// links inside the tooltip, but stops tooltips being
14+
// cutoff by the sidebar
15+
// https://atomiks.github.io/tippyjs/v6/faq/#my-tooltip-appears-cut-off-or-is-not-showing-at-all
16+
appendTo: document.body,
1217
});
1318
}

0 commit comments

Comments
 (0)