Skip to content

fix: prevent internal props rendering to DOM#7984

Open
joshblack wants to merge 3 commits into
joshblack/fail-on-console/expected-console-errorsfrom
joshblack/fail-on-console/class-name-fixtures
Open

fix: prevent internal props rendering to DOM#7984
joshblack wants to merge 3 commits into
joshblack/fail-on-console/expected-console-errorsfrom
joshblack/fail-on-console/class-name-fixtures

Conversation

@joshblack

@joshblack joshblack commented Jun 12, 2026

Copy link
Copy Markdown
Member

Fixes invalid className fixtures that emitted React DOM warnings during tests. Also fixes internal prop leaks for CircleBadge and deprecated ActionList.Group so those props are not rendered on DOM elements.

Changelog

New

  • N/A

Changed

  • CircleBadge no longer forwards internal styling props like inline, size, and variant to DOM elements.
  • Deprecated ActionList.Group no longer forwards internal props like groupId and showItemDividers to DOM elements.
  • Added regression coverage and updated snapshots for the internal prop filtering behavior.

Removed

  • N/A

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

Validated with build, tests, type-check, lint, CSS lint, and format checks. Includes a patch changeset. Added targeted regression assertions for CircleBadge and deprecated ActionList.Group to verify internal props are not rendered as DOM attributes.

Merge checklist

@changeset-bot

changeset-bot Bot commented Jun 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8c79aa0

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 Patch

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 staff Author is a staff member integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm labels Jun 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ 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.

@joshblack joshblack changed the title Use valid className test fixtures fix: prevent internal props rendering to DOM Jun 12, 2026
@github-actions github-actions Bot temporarily deployed to storybook-preview-7984 June 12, 2026 17:04 Inactive
@joshblack joshblack force-pushed the joshblack/fail-on-console/expected-console-errors branch from 09ab19c to 78c1fc6 Compare June 12, 2026 17:29
@joshblack joshblack force-pushed the joshblack/fail-on-console/class-name-fixtures branch from 1915503 to d302051 Compare June 12, 2026 17:29
@github-actions github-actions Bot requested a deployment to storybook-preview-7984 June 12, 2026 17:33 Abandoned
@github-actions github-actions Bot temporarily deployed to storybook-preview-7984 June 12, 2026 17:44 Inactive
@joshblack joshblack force-pushed the joshblack/fail-on-console/expected-console-errors branch from 78c1fc6 to 422d492 Compare June 12, 2026 18:31
@joshblack joshblack force-pushed the joshblack/fail-on-console/class-name-fixtures branch from d302051 to 8b05a66 Compare June 12, 2026 18:31
@github-actions github-actions Bot temporarily deployed to storybook-preview-7984 June 12, 2026 18:46 Inactive
@joshblack joshblack force-pushed the joshblack/fail-on-console/expected-console-errors branch from 422d492 to e8e6005 Compare June 15, 2026 16:24
@joshblack joshblack force-pushed the joshblack/fail-on-console/class-name-fixtures branch from 8b05a66 to d097ea6 Compare June 15, 2026 16:24
@joshblack joshblack marked this pull request as ready for review June 15, 2026 16:25
@joshblack joshblack requested a review from a team as a code owner June 15, 2026 16:25
@joshblack joshblack requested review from TylerJDev and Copilot June 15, 2026 16:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to eliminate React DOM warnings in tests caused by invalid implementsClassName fixtures, and to prevent internal/custom props from being forwarded onto DOM elements (notably in CircleBadge and deprecated ActionList.Group).

Changes:

  • Updated multiple implementsClassName usages in tests to render components with required props/children (e.g. aria-label, name, required slot children).
  • Adjusted deprecated ActionList.Group to stop forwarding groupId onto the rendered <div>.
  • Adjusted CircleBadge to avoid forwarding inline as a DOM attribute, and added a patch changeset.
Show a summary per file
File Description
packages/react/src/SegmentedControl/SegmentedControl.test.tsx Wraps SegmentedControl in a fixture that includes required aria-label for className testing.
packages/react/src/RadioGroup/RadioGroup.test.tsx Updates implementsClassName fixture to include required RadioGroup.Label child.
packages/react/src/Radio/Radio.test.tsx Updates implementsClassName fixture to include required name prop.
packages/react/src/FormControl/tests/FormControl.test.tsx Updates implementsClassName fixtures to include required FormControl.Label and an input child.
packages/react/src/Details/tests/Details.test.tsx Updates implementsClassName fixture to include required Details.Summary child.
packages/react/src/deprecated/ActionList/Group.tsx Stops forwarding groupId to the DOM by destructuring it out.
packages/react/src/DataTable/tests/Table.test.tsx Updates implementsClassName fixture for Table.Cell to render within a required table structure.
packages/react/src/CircleBadge/CircleBadge.tsx Stops forwarding inline to the DOM by destructuring it out.
packages/react/src/CheckboxGroup/CheckboxGroup.test.tsx Updates implementsClassName fixture to include required CheckboxGroup.Label child.
packages/react/src/tests/CheckboxOrRadioGroup.test.tsx Updates implementsClassName fixture to include required CheckboxOrRadioGroup.Label child.
.changeset/fix-dom-prop-warnings.md Adds a patch changeset documenting the DOM-prop leak prevention.

Copilot's findings

  • Files reviewed: 11/11 changed files
  • Comments generated: 2

Comment on lines 31 to 35
const CircleBadge = <As extends React.ElementType>({as: Component = 'div', inline, ...props}: CircleBadgeProps<As>) => (
<Component
{...props}
data-component="CircleBadge"
className={clsx(styles.CircleBadge, props.className)}
* Collects related `Items` in an `ActionList`.
*/
export function Group({header, items, ...props}: GroupProps): JSX.Element {
export function Group({header, items, groupId: _groupId, ...props}: GroupProps): JSX.Element {
@joshblack joshblack force-pushed the joshblack/fail-on-console/expected-console-errors branch from e8e6005 to 24c767b Compare June 15, 2026 16:37
@joshblack joshblack force-pushed the joshblack/fail-on-console/class-name-fixtures branch from d097ea6 to 884842d Compare June 15, 2026 16:37
@github-actions github-actions Bot temporarily deployed to storybook-preview-7984 June 15, 2026 16:39 Inactive
@joshblack

Copy link
Copy Markdown
Member Author

@copilot apply code review suggestions

Copilot AI and others added 2 commits June 15, 2026 17:56
Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>

Copilot AI commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

@copilot apply code review suggestions

Addressed in 8c79aa0.

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

Labels

integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm staff Author is a staff member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants