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: intermediate parents' scope ids are not reflected to the children elements #5774

Closed
3 tasks done
yigityuce opened this issue May 17, 2024 · 3 comments
Closed
3 tasks done
Assignees
Labels
Bug: Validated This PR or Issue is verified to be a bug within Stencil

Comments

@yigityuce
Copy link
Contributor

Prerequisites

Stencil Version

4.18.1

Current Behavior

as you already know #5702 and #5749 issue fixes are already merged & shipped with v4.18.1.

One last time (I hope) we need to update this logic. I found out we don't add the intermediate components' scope ids to the children elements. Think about having a component structure like below:

my-timepicker -------> my-input ---------> input (native)
             |
             | ------> my-menu --------> my-popover ---------> my-list-item --------> whatever

given that component structure I have these style files:

// FILE: my-list-item.scss
:host {
  text-transform: none;
}


// FILE: my-menu.scss
:host {
  my-list-item {
    font-weight: 800;
  }
}


// FILE: my-timepicker.scss
:host {
  my-menu {
    my-list-item {
      text-transform: uppercase;
      color: red;
    }
  }
}

and as a result of compilation I want to have all of those styles for the my-list-item component which is used within the timepicker:

font-weight: 800; // from menu - MISSING - intermediate style
text-transform: uppercase; // from timepicker - OK
color: red; // from timepicker - OK

the problem is only the root component's scope id (sc-my-timepicker) is added to the child component. But all the parent components' scope ids must be added. Otherwise, when you use it in another parent, the styles get broken since it only receives the most parent components scope id.

P.S: I reused the existing reproduction repo by updating it. Here you can find the updates.

image

Expected Behavior

image

System Info

System: node 18.20.2
    Platform: darwin (23.4.0)
   CPU Model: Apple M3 Pro (12 cpus)
    Compiler: /Users/yigit.yuce/Documents/Projects/personal/yigityuce.github/stencil-v4-sc-nested-css-scope-id/node_modules/@stencil/core/compiler/stencil.js
       Build: 1715629646
     Stencil: 4.18.1 🏍
  TypeScript: 5.4.5
      Rollup: 2.56.3
      Parse5: 7.1.2
      jQuery: 4.0.0-pre
      Terser: 5.31.0

Steps to Reproduce

Reproduction repo: https://github.com/yigityuce/stencil-v4-sc-nested-css-scope-id

Code Reproduction URL

https://github.com/yigityuce/stencil-v4-sc-nested-css-scope-id

Additional Information

No response

@ionitron-bot ionitron-bot bot added the triage label May 17, 2024
@christian-bromann christian-bromann added Bug: Validated This PR or Issue is verified to be a bug within Stencil and removed triage labels May 22, 2024
@christian-bromann christian-bromann self-assigned this May 22, 2024
github-merge-queue bot pushed a commit that referenced this issue May 24, 2024
…nts (#5775)

* fix(runtime): add missing intermediate parents scope ids to the elements

#5774

* test: add missing e2e test cases

* test: remove duplicated await statement
@yigityuce
Copy link
Contributor Author

since it has been merged, this issue is resolved and I'm closing it. Thanks everyone for their supports 🚀

@yigityuce
Copy link
Contributor Author

yigityuce commented May 27, 2024

hey @christian-bromann please don't take it as a push but do you know when will be the next version released?

@christian-bromann
Copy link
Member

It should be this week.

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

2 participants