Elektrine lite

← Feed

@nickchomey@mastodon.social

Post #2019171

2026-05-05 11:30 UTC

@spartanatreyu I think you're quite mistaken about what datastar actually is... what server coupling are you talking about...? I was suggesting just adding something like data-on:click="!$navToggle" to the nav button and data-show="$navToggle" to the nav parent element, which could be/include any of the html features you just described. No network request (let alone full page nav and history games!) required. Toggling aria-expanded would be similarly simple and js-free

Replies (1)

  • @nickchomey@mastodon.social 2026-05-05 12:18

    @spartanatreyu @jimniels Here's an example, which seems to handle nav and aria without any separate js script. Just a few declarative attributes. https://codepen.io/nickchomey/pen/RNoWPZz I did it from my phone, so perhaps the aria isn't correct. But surely you can see how much simpler this is, and better ux not having a full nav. Just a one-time 10kb download of datastar, which affords endless other capabilities. Edit: I added an implementation with the Invoker Commands API. Probably best solution of all

    Open ##2019172