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

Tabset ViewEncapsulation #3479

Closed
msqaddura opened this issue Nov 21, 2019 · 5 comments · Fixed by #3535
Closed

Tabset ViewEncapsulation #3479

msqaddura opened this issue Nov 21, 2019 · 5 comments · Fixed by #3535

Comments

@msqaddura
Copy link

Hey guys, hope you are doing well

what do you think about changing the View Encapsuation of NgbTabset to None? as we really needed to change it quite often

Thanks in advance!

@maxokorokov
Copy link
Member

@msqaddura seems to me as a duplicate of #2930.
But I guess we should explicitly set it to None everywhere as it was suggested.

@msqaddura
Copy link
Author

@maxokorokov as I understand, the problem is rather coming from angular https://angular.io/api/core/Component#encapsulation

If not supplied, the value is taken from CompilerOptions. The default compiler option is ViewEncapsulation.Emulated.

If the policy is set to ViewEncapsulation.Emulated and the component has no styles or styleUrls specified, the policy is automatically switched to ViewEncapsulation.None.

So i assume you want it anyway to be ViewEncapsulation.None, and I assume that the reason why it is not working is because of the exportAs. so it goes back to ViewEncapsulation.Emulated

Since the consent is to have it ViewEncapsulation.None, why not putting it implicitly? It might help a lot of people, me inclusive :P

@maxokorokov
Copy link
Member

@mschoudry, yes we should put it explicitly

@msqaddura
Copy link
Author

@maxokorokov maybe you wanted to tag me instead. and as well might have got me wrong
I meant maybe we do it here in the ngbootstrap. as long as the consent is to have it None be it directly or through compiler indirectly

@msqaddura
Copy link
Author

msqaddura commented Nov 25, 2019

I will explain a bit more so we stay on the same page

The Assumption (the way I understood from previous comments) :
Following angular guide, ViewEncapsulation.None was not needed inside NgbTabset due to the fact that angular compiler will automatically transform it to ViewEncapsulation.None due to the lack of styles or styleUrls.

Expectation (based on the assumption )
NgbTabset inside our host components will have ViewEncapsulation.None, hence can be styled explicitly without the need to add ViewEncapsulation.None in our host component.

Result
Different from expectation & assumption, NgbTabset does not get ViewEncapsulation.None and the only way to style it is to implicitly add the host component ViewEncapsulation.None.

Solution

  • Add ViewEncapsulation.None to NgbTabset
  • Find out why the behaviour is different from angular guide.

Is that what is happening or am I getting something wrong?

maxokorokov added a commit to maxokorokov/ng-bootstrap that referenced this issue Jan 8, 2020
Previously it was added only to components with custom styles

Fixes ng-bootstrap#3479
maxokorokov added a commit that referenced this issue Jan 9, 2020
Previously it was added only to components with custom styles

Fixes #3479
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment