Introducing command And commandfor In HTML
Published on: 2025-06-27 15:24:02
Keith Cirkel
Buttons are essential to making dynamic web applications. Buttons open menus, toggle actions, and submit forms. They provide the foundation of interactivity on the web. Making buttons simple and accessible can lead to some surprising challenges. Developers building micro-frontends or component systems can encounter solutions that become more complex than necessary. While frameworks help, the web can do more here.
Chrome 135 introduces new capabilities for providing declarative behaviour with the new command and commandfor attributes, enhancing and replacing the popovertargetaction and popovertarget attributes. These new attributes can be added to buttons, letting the browser address some core issues around simplicity and accessibility, and provide built-in common functionality.
Traditional patterns
Building button behaviours without a framework can pose some interesting challenges as production code evolves. While HTML offers onclick handlers to buttons, these are ofte
... Read full article.