Skip to content

ActionMenu.Anchor doesn't accept id param and doesn't pass up child id either #4299

@milemons

Description

@milemons

Description

I noticed that when you use ActionMenu.Anchor for an ActionMenu, there is no way to specify an Id for the button because it checks the anchor/button itself (not the children) for an id but the Anchor type doesn't include an id, unlike the Button type

Steps to reproduce

Example code:
https://github.com/github/github/blob/080953f77c52d03e8c896ec94a9f8592d0a48878/ui/packages/copilot-code-chat/CopilotChatButton.tsx#L67C11-L78C31

          <ActionMenu.Anchor>
            <IconButtonWithTooltip
              id="ICON_ID"
              icon={TriangleDownIcon}
              label="Copilot menu"
              hideTooltip={open}
              onSelect={() => setOpen(true)}
              size="small"
              sx={{...squareHeightSx, '>span': {mb: 0}, color: 'fg.muted'}}
              tooltipDirection="sw"
              data-testid="more-copilot-button"
            />
          </ActionMenu.Anchor>

The button will have a random ID assigned and the Anchor will not accept an ID itself.

Version

current

Browser

Chrome, Safari, Firefox, Edge, iOS Safari

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions