Skip to content
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

bug: scoped component styles are not applied to child elements #6042

Open
3 tasks done
hbeyan opened this issue Nov 6, 2024 · 1 comment
Open
3 tasks done

bug: scoped component styles are not applied to child elements #6042

hbeyan opened this issue Nov 6, 2024 · 1 comment
Assignees
Labels
Bug: Validated This PR or Issue is verified to be a bug within Stencil

Comments

@hbeyan
Copy link
Contributor

hbeyan commented Nov 6, 2024

Prerequisites

Stencil Version

4.22.2

Current Behavior

We have encountered the following issue with using non-shadow and scoped components on our projects: sometimes scoped classes of the component are not applied to the child elements of component, and breaks the styling.

When we checked the properties, we observed that "s-scs" on children is empty, and children classes doesn't contain the scoped class of component.

This issue doesn't happen in all platforms, but we could isolate to es5 targets on typescript, and to following code line

element.classList?.add(...(element['s-scs'] = [...scopeIds]));

and we think that it's caused by spread operator not being translated correctly for all typescript configurations, which is related to this typescript issue: microsoft/TypeScript#8856.

Expected Behavior

We expect that the children elements of scoped components should have the scoped classes of parent components.

System Info

No response

Steps to Reproduce

  1. Clone the repo https://github.com/hbeyan/stencil-scoped-children-style
  2. Run the project with "npm run start"
  3. We have a component called"my-button, which gives "background-color: red;" to the regular "button" element inside.
  4. Check the "button" element inside the "my-button" component, and see that "background-color: red;" is not applied. Class "sc-my-button" is not applied to the "button" element, also "s-scs" property is empty. Manually adding this class to "button" solves the issue.

Code Reproduction URL

https://github.com/hbeyan/stencil-scoped-children-style

Additional Information

No response

@yigityuce
Copy link
Contributor

hey @christian-bromann @rwaskiewicz

@hbeyan is my colleague, and as a team we are having issue in our project due to the Set typedArray usage. Could you please prioritize this issue and the PR.

Thanks in advance.

@christian-bromann christian-bromann self-assigned this Nov 6, 2024
@christian-bromann christian-bromann added Bug: Validated This PR or Issue is verified to be a bug within Stencil and removed triage labels Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug: Validated This PR or Issue is verified to be a bug within Stencil
Projects
None yet
Development

No branches or pull requests

3 participants