I’ve added a secret glossary to my blog! You might find it by hovering over special links. Don’t tell anyone, it’s a secret. At least until I can find a way to style the links without them being a distraction. Do I need to, or can they remain
The Idea
This project came about when I noted concern over my reliance on
The Implementation
I write my blog posts in
[React](/glossary/react.json)
This references a
{
"title": "React",
"description": "A legacy JavaScript framework (turned religion). Favoured by tech bros and famous for bloated bundles and crippling web performance.",
"links": [
{
"name": "JSX.lol",
"title": "Does anybody actually like React?",
"url": "https://jsx.lol"
},
{
"name": "React",
"url": "https://react.dev"
}
]
}
My build script replaces the markdown link with a
<glossary-term id="--term-react">
<a href="https://jsx.lol">React</a>
</glossary-term>
The first link in the JSON is used as the canonical source.
HTML wrapped in a <glossary-term>
element is enhanced with a fancy popover.
If you’ve missed every example so far here is the
I captured a screen recording of how it should appear:
The popover is activated by either hover or keyboard focus. The escape key can also dismiss them. For touchscreens I’m going to test that live…
[INSERT TEST RESULTS]
Test results: it works fine. If you’ve got one of those new Apple Pencils — the new new one, not the new old one — the hover effect is magical. Touch taps are taken straight to the canonical link. The popover might be open upon return. Maybe I should cancel the popover based on touch events to avoid confusion?
Failures
Initially I tried to use
I really tried. It left me in tears and I rage quit. It might be the most unintuitive, doesn’t work like it says, infuriating web “standard” ever. When anchoring a popover
it’s impossible to ensure elements stay inside the viewport (without JavaScript). Please prove me wrong!
I tried to get creative with allow-discrete
and @starting-style
and failed. In an isolated demo it’s all gravy but together this new CSS stuff doesn’t plays nice. It’s not all
CSS anchors are Chrome and
Ultimately I gave up and used
Bookmarking
I don’t plan to immediately retrofit older blog posts with glossary links. Although that could be a quick find & replace if I’m careful. I’m looking for positive feedback before I do. So let me know if you like it (or not). If no one hates it I’ll plough ahead, because I like it. This glossary may just be the third incarnation of my bookmarks blog.
I’m tempted to use a similar technique to create popover cards for linked notes. They have more content so I need to consider that more.