Skip to content

feat(compiler): support for CustomStateSet #6286

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 25, 2025

Conversation

pfteter
Copy link
Contributor

@pfteter pfteter commented Jun 10, 2025

Ticket: #6285

Stencil Version

4.33

Current Behavior

@AttachInternals() internals!: ElementInternals;

cannot be used without
formAssociated: true in the metadata.

because of a condition in the compiler

Expected Behavior

@AttachInternals() internals!: ElementInternals;

should work without formAssociated: true in the metadata.

CustomStateSet can now be used without formAssociated for components that are not formAssociated.

Improvement: Add stencil support for custom state.

System Info

Steps to Reproduce

add

@AttachInternals() internals!: ElementInternals;

to a component, an console error will be shown

Code Reproduction URL

Additional Information

Will commit a fix for it, the solution is quite easy:
https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/attachInternals

Does this introduce a breaking change?

  • Yes
  • No

Testing

Manual testing / changing code in node_modules

@pfteter pfteter requested a review from a team as a code owner June 10, 2025 12:42
Copy link
Member

@christian-bromann christian-bromann left a comment

Choose a reason for hiding this comment

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

Thanks for raising this PR.

Can we create a test for this? I suggest a WDIO e2e test that verifies that a component without the formAssociated flag can use element internals.

@christian-bromann
Copy link
Member

Also could we update the docs as they should be clarify that element internals can be used without form association.

@christian-bromann
Copy link
Member

@pfteter mind running npm run prettier and check in the changes?

Copy link
Member

@christian-bromann christian-bromann left a comment

Choose a reason for hiding this comment

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

Thanks a lot 👍

@christian-bromann christian-bromann merged commit 7132259 into stenciljs:main Jun 25, 2025
70 checks passed
@pfteter pfteter changed the title fix(compiler): fix attachInternals should be usable without formAssoc… feat(compiler): support for CustomStateSet Jun 25, 2025
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.

2 participants