Skip to content

🤖 [react] Add commandFor and command attributes to ButtonHTMLAttributes#75012

Open
algojogacor wants to merge 2 commits into
DefinitelyTyped:masterfrom
algojogacor:fix/react-button-commandfor-attributes
Open

🤖 [react] Add commandFor and command attributes to ButtonHTMLAttributes#75012
algojogacor wants to merge 2 commits into
DefinitelyTyped:masterfrom
algojogacor:fix/react-button-commandfor-attributes

Conversation

@algojogacor
Copy link
Copy Markdown

Fixes #74664

Summary

Add commandFor and command HTML attributes from the Invoker Commands API to React's ButtonHTMLAttributes interface across all supported type versions.

Documentation

Browser Support

  • Chrome/Edge 135+
  • Safari Technology Preview
  • Firefox Nightly (behind flag)

Changes

  • types/react/index.d.ts: add command?: string | undefined and commandFor?: string | undefined (+2)
  • types/react/ts5.0/index.d.ts: same (+2)
  • types/react/v18/index.d.ts: same (+2)
  • types/react/v18/ts5.0/index.d.ts: same (+2)
  • types/react/test/elementAttributes.tsx: add test cases for all 3 command value forms — built-in (toggle-popover, show-modal) and custom (--custom-action) (+5 -1)

Testing

  • <button commandFor="my-popover" command="toggle-popover">: compiles ✅
  • <button commandFor="my-dialog" command="show-modal">: compiles ✅
  • <button commandFor="custom" command="--custom-action">: custom prefixed values compile ✅
  • Existing popoverTarget/popoverTargetAction tests still pass ✅

These attributes are part of the Invoker Commands API (open-ui.org),
supported in Chrome/Edge 135+, Safari TP, and Firefox Nightly.

Closes DefinitelyTyped#74664
@typescript-bot
Copy link
Copy Markdown
Contributor

typescript-bot commented May 17, 2026

@algojogacor Thank you for submitting this PR! I see this is your first time submitting to DefinitelyTyped 👋 — I'm the local bot who will help you through the process of getting things through.

This is a live comment that I will keep updated.

1 package in this PR

Code Reviews

Because this is a widely-used package, a DT maintainer will need to review it before it can be merged.

You can test the changes of this PR in the Playground.

Status

  • ✅ No merge conflicts
  • ✅ Continuous integration tests have passed
  • 🕐 Most recent commit is approved by a DT maintainer

Once every item on this list is checked, I'll ask you for permission to merge and publish the changes.

Inactive

This PR has been inactive for 10 days.


Diagnostic Information: What the bot saw about this PR
{
  "type": "info",
  "now": "-",
  "pr_number": 75012,
  "author": "algojogacor",
  "headCommitOid": "ea47bfd1ac01c329accc8a796aa433e7ce8db318",
  "mergeBaseOid": "c6fb7d2e0e833931ac92da131709d2c6178ce3d8",
  "lastPushDate": "2026-05-17T08:16:16.000Z",
  "lastActivityDate": "2026-05-17T08:16:16.000Z",
  "hasMergeConflict": false,
  "isFirstContribution": true,
  "tooManyFiles": false,
  "hugeChange": false,
  "tooManyCommits": false,
  "tooManyReviews": false,
  "popularityLevel": "Critical",
  "pkgInfo": [
    {
      "name": "react",
      "kind": "edit",
      "files": [
        {
          "path": "types/react/index.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/react/test/elementAttributes.tsx",
          "kind": "test"
        },
        {
          "path": "types/react/ts5.0/index.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/react/v18/index.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/react/v18/ts5.0/index.d.ts",
          "kind": "definition"
        }
      ],
      "owners": [
        "johnnyreilly",
        "bbenezech",
        "pzavolinsky",
        "ericanderson",
        "DovydasNavickas",
        "theruther4d",
        "guilhermehubner",
        "ferdaber",
        "jrakotoharisoa",
        "pascaloliv",
        "hotell",
        "franklixuefei",
        "Jessidhia",
        "saranshkataria",
        "lukyth",
        "eps1lon",
        "zieka",
        "dancerphil",
        "dimitropoulos",
        "disjukr",
        "vhfmag",
        "priyanshurav",
        "Semigradsky",
        "mattpocock"
      ],
      "addedOwners": [],
      "deletedOwners": [],
      "popularityLevel": "Critical"
    }
  ],
  "reviews": [],
  "mainBotCommentID": 4469873452,
  "ciResult": "pass"
}

@typescript-bot
Copy link
Copy Markdown
Contributor

@typescript-bot typescript-bot moved this to Waiting for Code Reviews in Pull Request Status Board May 17, 2026
@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Maintainer Review in Pull Request Status Board May 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Needs Maintainer Review

Development

Successfully merging this pull request may close these issues.

[react] Add commandFor and command attributes to ButtonHTMLAttributes

2 participants