Add Tippy.js tooltips to focusable elements

This commit is contained in:
Bad Manners 2024-09-07 18:28:08 -03:00
parent a2fbf908aa
commit 09934a9f8e
No known key found for this signature in database
GPG key ID: 8C88292CCB075609
11 changed files with 73 additions and 29 deletions

View file

@ -143,6 +143,7 @@ const isCurrentRoute = (path: string) =>
</main>
</div>
</BaseLayout>
<style>
nav ul li a,
nav ul li button {
@ -159,3 +160,17 @@ const isCurrentRoute = (path: string) =>
height: 1ex;
}
</style>
<script>
import tippy from "tippy.js";
import "tippy.js/dist/tippy.css";
const clipboardItems = document.querySelectorAll<HTMLElement>("[data-clipboard]");
tippy(clipboardItems, {
content: (el) => (el as HTMLElement).dataset.clipboard!,
theme: "bm",
});
clipboardItems.forEach((el) => el.removeAttribute("title"));
</script>