• Kissaki@programming.dev
    link
    fedilink
    English
    arrow-up
    11
    ·
    2 days ago

    MDN (linked at the end of the article) is so much more concise. I didn’t find the broad overview in this linked article. From MDN:

    A common pattern on the web is to have <button> elements control various aspects of the page, such as opening and closing popovers or <dialog> elements, formatting text, and more.

    Historically creating these kinds of controls has required JavaScript event listeners added to the button which can then call the APIs on the element they control. The commandForElement and command properties provide a way to do this declaratively for a limited set of actions. This can be advantageous for built-in commands as the user does not have to wait for JavaScript to download and execute to make these buttons interactive.

    So built in button action commands, replacing the need for custom JavaScript for standard actions.

    The list of commands defined right now: toggle-popover, show-popover, hide-popover, close, show-modal