Reminder: You Can Stitch Together Lots of Little HTML Pages With Navigations For Interactions

94 points by LesleyLai


sporiff

I'm generally a fan of always responding with HTML, however I'm not so sure about things like menus. I'd be interested to hear an accessibility expert's input on what's better between a toggleable element and a full page transition to open up a menu.

The Popover API feels like it would be the better solution here, since you can ship a JS-free menu without invoking a full round trip. As for most other things, I agree that we shouldn't fear the page transition. SPA-like navigation is now nearly always accessible to SSR and static sites with little difficulty.

laat

The presented method uses JavaScript and onclick to dynamically load a menu. This introduces latency and an extra datapoint on the user journey.

Instead, the menu could be added to each page and shown and hidden with the <details> element or with the :focus-within CSS selector. This is how https://nlnet.nl does it.

vrolfs

Nice post! However, the approach described doesn't actually work at all: If you open the blog post with JS disabled, then open+close the menu, you will land on the home page (/), not on the blog post. The described approach will only work if you dynamically render the menu on the backend, in order to have a correct link for the close button.

Personally I would also prefer using the Popover API if possible, since then everything can be statically rendered without a backend.