Skip to content

fix(ssr): expand ::part css selectors for ssr scoped components - #6298

Merged
christian-bromann merged 3 commits into
mainfrom
fix-expand-part-selectors
Jun 16, 2025
Merged

christian-bromann merged 3 commits into
mainfrom
fix-expand-part-selectors

Conversation

@johnjenkins

@johnjenkins johnjenkins commented Jun 13, 2025 •

Copy link
Copy Markdown
Contributor

What is the current behavior?

GitHub Issue Number: #6297

What is the new behavior?

Fixes #6297

When scoped components are detected during SSR, expand any ::part(...) selectors to also include the format [part~="..."]. This catches any components whose shadow-root is not yet attached

Documentation

Does this introduce a breaking change?

  • Yes
  • No

Testing

Other information

Follow on idea:

I think this behaviour could also be tweaked slightly for client-side css selectors if scoped components are in the build.

i.e. if BUILD.scoped extend all ::part selectors to include [part~="..."]
This would mean scoped: true components could use <div part="thing"> safely; one more step closer to being interchangeable with shadow: true

@johnjenkins
johnjenkins requested a review from a team as a code owner June 13, 2025 19:34

@christian-bromann christian-bromann 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.

LGTM 👍

@christian-bromann
christian-bromann merged commit da24af6 into main Jun 16, 2025
@christian-bromann
christian-bromann deleted the fix-expand-part-selectors branch June 16, 2025 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: serializeShadowRoot: 'scoped' renders incorrect, initial ::part() styling

2 participants