Get the latest tech news
Introducing command And commandfor In HTML
Learn about the new capabilities for declarative behavior on buttons.
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. While HTML offers onclick handlers to buttons, these are often disallowed outside of demos or tutorials due to Content Security Policy (CSP) rules. These commands map to their JavaScript counterparts, while also streamlining accessibility (such as providing the aria-details and aria-expanded equivalent relations), focus management, and more.
Or read this on Hacker News