<aside> 💡

<button commandfor="x" command="show-modal"> lets you write in HTML which element a button controls. You can open and close dialogs and popovers without JavaScript, and the browser adds the semantics (such as aria-expanded) for you. But there are only six built-in commands, and inside a form you must write type="button". Stateful widgets like tabs and toasts still need you to fill the gaps.

</aside>

Why now

On 2026-11-18 (JST), "Show HN: Alloy CSS, dialogs, menus and tabs that work with JavaScript off" was posted to Hacker News and reached 211 points. The author wrote that on client projects they kept loading a JS library "just to open a dropdown or a modal". They explained that they rebuilt the kit this year because "commandfor, popover and :has() now do most of that natively". The demo is an invoicing screen: one HTML file with Alloy's CSS and no JavaScript.

The thread split into camps.

So the real question is not "can we delete JS?". It is how much can we hand to the browser, and where do we have to fill in ourselves? The new feature that sits right on that line is Invoker Commands (command / commandfor). It shipped in Chrome / Edge 135, Firefox 144 and Safari 26.2, and became Baseline (Newly available) on 2025-12-12. This year it has reached the point where teams are deciding it is ready for real projects.

The sister feature that opens on hover, Interest Invokers (interestfor), was covered in the 2026-09-25 report. This piece covers the click-to-commit side.

The problem

Web UIs are full of "this button controls that element": open a menu, open a modal, close it. Until now there were roughly three ways to write it.

  1. onclick="dlg.showModal()": easy, but inline event handlers are often banned by CSP (the Chrome article makes this point too).
  2. addEventListener in a JS bundle: the button does nothing until the JS has loaded and run. In micro-frontends, the wiring between a button and its target ends up spread across files.
  3. popovertarget: declarative, but it only works for popovers.

On top of that, telling the accessibility tree about open/closed state (updating aria-expanded, linking the button to its target) is left to the author, and that is where things get missed.

The design questions come down to three: