Post #2004563
2026-05-04 04:37 UTC
Replies (5)
-
@martingwd@mastodon.social 2026-05-04 04:49
@jimniels love this super elegant solution, thank you for sharing Jim!
-
@nickchomey@mastodon.social 2026-05-04 12:16
@jimniels I came across this post on HN. it's a nice instinct to try to be js-free, but then you're just using js to manipulate your history, which is surely far more blasphemous than a sprinkling of js to show/hide a menu. Especially when you're doing a full nav for this. I beg you to check out Datastar. It's precisely what you're looking for. It's more powerful than htmx + alpine js, and smaller than both. You could just have a few declarative html attributes that show/hide the menu.
-
@cjoly@hachyderm.io 2026-05-04 14:32
@jimniels Thanks for documenting this trick! I had such a menu on a separate page on my own website for a while, but I grew tired of it. I ended up just putting back 5 links at the top. Ultimately, it’s a personal website, it boils down to personal preference. I’m of course not saying your approach is wrong. I certainly wish more website adopted it instead of cascading expand on hover from hell. Anyway, I ended up reading a bunch of other posts and subscribing to the RSS feed. Thanks for building this blog, I really enjoy it!
-
@konform@techhub.social 2026-05-04 22:06
@jimniels For simple inlineable content like a menu, I think you can do even better in pure CSS and hiding/showing it using attribute selectors. Smoother UX since you don't need to trigger navigation and can forego JS alltogether without degradation. https://stackoverflow.com/a/33528185 Using a variation of this on Konform Browser front page to dynamically toggle display of installation instructions for the target selected by user with CSS only: https://konform-browser.codeberg.page/ #nojs #css
-
@loucyx@mastodon.social 2026-05-05 05:42
@jimniels it’s also worth mentioning you can get a menu with no JS and a single HTML by using the Invoker Commands API, which is already baseline. Nowadays we can do almost anything without using JS on the client side 💖