The /projects page includes screenshots of my projects but clicking them used to simply redirect to the project URL. This has always bugged me, but I didn’t want to add a dedicated lightbox library as I hate adding unnecessary libraries to projects.
I figured there must be an easy way to do it with just CSS + simple JS and it turns out, there is!
<dialog>
The first part of the puzzle is the <dialog> element.
<dialog>
<h1>This is my modal</h1>
</dialog>
It’s used to represent modals and non-modal dialog boxes, which is exactly what we need.