Skip to content

Theme: Skip serializing data-wpds-root-provider="false" on non-root providers#79253

Merged
ciampo merged 2 commits into
trunkfrom
fix/theme-skip-false-root-provider-attr
Jun 17, 2026
Merged

Theme: Skip serializing data-wpds-root-provider="false" on non-root providers#79253
ciampo merged 2 commits into
trunkfrom
fix/theme-skip-false-root-provider-attr

Conversation

@ciampo

@ciampo ciampo commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

What?

See #77462 (point I3).

Stops ThemeProvider from rendering data-wpds-root-provider="false" on every non-root provider.

Why?

The attribute is only ever matched as ="true" (by the prebuilt CSS and the runtime selector). Serializing "false" on every non-root provider is just dead markup.

How?

Set the attribute with data-wpds-root-provider={ isRoot || undefined } so React omits it entirely when isRoot is false.

Testing Instructions

  1. Render a <ThemeProvider> without isRoot and confirm the wrapper <div> has no data-wpds-root-provider attribute.
  2. Render a <ThemeProvider isRoot> and confirm the wrapper <div> still has data-wpds-root-provider="true".
  3. Run npm run test:unit packages/theme.

Use of AI Tools

This PR was authored with the assistance of AI tooling (Cursor); all changes were reviewed by me.

Only set the attribute when isRoot is true, so React drops it on
non-root providers instead of serializing it as "false".
@github-actions github-actions Bot added the [Package] Theme /packages/theme label Jun 16, 2026
@ciampo ciampo self-assigned this Jun 16, 2026
@ciampo ciampo added the [Type] Enhancement A suggestion for improvement. label Jun 16, 2026
@ciampo ciampo marked this pull request as ready for review June 16, 2026 22:13
@ciampo ciampo requested a review from a team as a code owner June 16, 2026 22:13
@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: ciampo <[email protected]>
Co-authored-by: mirka <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown

Size Change: +5 B (0%)

Total Size: 8.6 MB

📦 View Changed
Filename Size Change
build/scripts/theme/index.min.js 22.3 kB +5 B (+0.02%)

compressed-size-action

@mirka mirka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Straightforward 👍

Comment thread packages/theme/CHANGELOG.md Outdated
Comment thread packages/theme/CHANGELOG.md Outdated
@ciampo ciampo enabled auto-merge (squash) June 17, 2026 18:44
@ciampo ciampo disabled auto-merge June 17, 2026 18:44
@ciampo ciampo enabled auto-merge (squash) June 17, 2026 18:44
@ciampo ciampo merged commit 51a8d73 into trunk Jun 17, 2026
43 of 44 checks passed
@ciampo ciampo deleted the fix/theme-skip-false-root-provider-attr branch June 17, 2026 19:16
@github-actions github-actions Bot added this to the Gutenberg 23.5 milestone Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Theme /packages/theme [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants