I've read that ShadowDOM isolates the shadow dom tree from external css so i've tried to play around with it in Angular using ViewEncapsulation.ShadowDom, but it seems like the global css are still leaking into the Shadow DOM.
Kindly see the code here: https://stackblitz.com/edit/shadow-dom-test?file=src/app/app.component.ts
import { Component, VERSION, ViewEncapsulation } from '@angular/core';
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: [ './app.component.css' ],
encapsulation: ViewEncapsulation.ShadowDom
})
export class AppComponent {
name = 'Angular ' + VERSION.major;
}
After that, setting any css in style.css will affect the elements under AppComponent even though the encapsulation is set to ViewEncapsulation.ShadowDomand the component is contained under ShadowDom tree.
See the screenshot below, Font-size is inherited by elements under ShadowDOM

some css? Can you please specify the issue?AppComponenteven though it hasViewEncapsulation.ShadowDom. I've always thought that global styles won't affect elements under ShadowDom.