Skip to content

data-component adr part 3#7819

Open
llastflowers wants to merge 6 commits intomainfrom
llastflowers/6497/data-component-ADR-part-3
Open

data-component adr part 3#7819
llastflowers wants to merge 6 commits intomainfrom
llastflowers/6497/data-component-ADR-part-3

Conversation

@llastflowers
Copy link
Copy Markdown
Contributor

@llastflowers llastflowers commented May 7, 2026

Relates to https://github.com/github/primer/issues/6497

Changelog

New

Add data-component attributes and associated tests for Details, Flash, FormControl (+ update InputValidation to forward from FormControl.Validation), Header, and Heading.

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

Testing & Reviewing

Merge checklist

Copilot AI review requested due to automatic review settings May 7, 2026 19:34
@llastflowers llastflowers requested a review from a team as a code owner May 7, 2026 19:34
@llastflowers llastflowers requested a review from joshblack May 7, 2026 19:34
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 7, 2026

🦋 Changeset detected

Latest commit: 0c0214b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label May 7, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

⚠️ Action required

👋 Hi, this pull request contains changes to the source code that github/github-ui depends on. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. Check the integration testing docs for step-by-step instructions. Or, apply the integration-tests: skipped manually label to skip these checks.

To publish a canary release for integration testing, apply the Canary Release label to this PR.

@llastflowers llastflowers added the Canary Release Apply this label when you want CI to create a canary release of the current PR label May 7, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds stable data-component attributes (per ADR rollout) to several Primer React components and introduces unit tests to verify those attributes are rendered.

Changes:

  • Add data-component markers to Details, Flash, FormControl (and related slots), Header, and Heading.
  • Extend internal InputValidation to accept/pass through a data-component value for FormControl.Validation.
  • Add/extend unit tests asserting data-component attributes for the updated components.
Show a summary per file
File Description
packages/react/src/internal/components/InputValidation.tsx Adds optional data-component prop and applies it to the rendered Text.
packages/react/src/Heading/Heading.tsx Adds data-component="Heading" to the root element.
packages/react/src/Heading/tests/Heading.test.tsx Adds a test asserting Heading renders the data-component attribute.
packages/react/src/Header/Header.tsx Adds data-component to Header, Header.Item, and Header.Link.
packages/react/src/Header/Header.test.tsx Adds tests asserting data-component attributes for Header and subcomponents.
packages/react/src/FormControl/FormControlLeadingVisual.tsx Adds data-component="FormControl.LeadingVisual".
packages/react/src/FormControl/FormControlLabel.tsx Adds data-component="FormControl.Label" to the label render.
packages/react/src/FormControl/FormControlCaption.tsx Adds data-component="FormControl.Caption".
packages/react/src/FormControl/FormControl.tsx Adds data-component="FormControl" to the layout wrapper elements.
packages/react/src/FormControl/_FormControlValidation.tsx Passes data-component="FormControl.Validation" into InputValidation.
packages/react/src/FormControl/tests/FormControl.test.tsx Adds tests for FormControl/slot data-component attributes (one test currently has a lint-breaking unused variable).
packages/react/src/Flash/Flash.tsx Adds data-component="Flash" to the root element.
packages/react/src/Flash/tests/Flash.test.tsx Adds a test asserting Flash renders the data-component attribute.
packages/react/src/Details/Details.tsx Adds data-component to Details root and Details.Summary.
packages/react/src/Details/tests/Details.test.tsx Adds tests asserting Details and Details.Summary render data-component attributes.

Copilot's findings

  • Files reviewed: 16/16 changed files
  • Comments generated: 1

expect(container.firstElementChild).toHaveAttribute('data-component', 'FormControl')
expect(getByText(LABEL_TEXT)).toHaveAttribute('data-component', 'FormControl.Label')

const leadingVisual = container.querySelector('[data-component="FormControl.LeadingVisual"]')
@github-actions github-actions Bot requested a deployment to storybook-preview-7819 May 7, 2026 19:41 Abandoned
@primer
Copy link
Copy Markdown
Contributor

primer Bot commented May 7, 2026

🤖 Lint issues have been automatically fixed and committed to this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Canary Release Apply this label when you want CI to create a canary release of the current PR integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants