W3C home > Mailing lists > Public > public-css-archive@w3.org > May 2020

Re: [csswg-drafts] [css-cascade] How do custom origins interact with `!important`? (#4971)

From: CSS Meeting Bot via GitHub <sysbot+gh@w3.org>
Date: Wed, 13 May 2020 16:51:24 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-628115258-1589388683-sysbot+gh@w3.org>
The CSS Working Group just discussed ``[css-cascade] How do custom origins interact with `!important`?``.

<details><summary>The full IRC log of that discussion</summary>
&lt;dael> Topic: [css-cascade] How do custom origins interact with `!important`?<br>
&lt;dael> github: https://github.com/w3c/csswg-drafts/issues/4971<br>
&lt;dael> miriam: Touched on this at F2F<br>
&lt;dael> miriam: This ties in closely with question of where cascade layers fit in cascade. Interact with origins or some layer below.<br>
&lt;dael> miriam: Question is how for normal in !important styles work in these layers. INtertwine in a way that single layer contains both normal and important styles so normal and important can overrider a different layer. My sense was no, but it would help with some use cases like new styles overriding old<br>
&lt;dael> miriam: Other is all important override all normal styles and you get 2 layers for each custom cascade and then need to answer if they reverse<br>
&lt;dael> miriam: Alternative is it's somewhat customizable and you can determine which of these you wan<br>
&lt;dael> fantasai: Definite use cases for inverted order that we have. THis is the way scoped styles work. There is a layer inbetween normal and !important which is animation layer. If someone needs a second layer they can have another custom layer and don't need !important. Specificity problesm should be addressed directily. Reverse order improtant shoudl be what we do. Only strong use case is I have old styles I want to be lower.<br>
&lt;TabAtkins> q+<br>
&lt;jensimmons> q+<br>
&lt;dael> miriam: Sense is with any of these if you can create custom origins you should be able to create any outcome from layering as needed.<br>
&lt;dael> miriam: Changes ordering of layers<br>
&lt;astearns> ack TabAtkins<br>
&lt;florian> q+<br>
&lt;dael> TabAtkins: I have an alterative. fantasai explianation is good in many, but an independant library you don't want its !important to leak out and overrider. Alternative is within a cascade layer there are no !important. We ignore or syntax error and that way we don't answer this. You just make a higher level if you want a higher level<br>
&lt;dael> fantasai: I don't think that quite works.<br>
&lt;dael> fantasai: You as a library don't control the ordering of layers. THat's dependant on how things are imports and master doc. Reasonable for something to express these are my styles and these rules need to exist or it breaks. THat would go into an important layer.<br>
&lt;dael> fantasai: I don't think that works super well if you have to create layers and importer has to know the order. We havea. mech for !important. If a library is using it for not important things that's bad on the library<br>
&lt;dael> TabAtkins: Your model is outer page is direct controller?<br>
&lt;dael> fantasai: I think it's possible for things to pull through multi level. All levels should have idea that if something is !important it's because it will be broken if I don't have it.<br>
&lt;dael> TabAtkins: Common practice for !important is not the best hting here.<br>
&lt;dael> fantasai: People doing it wrong are already making brokens stuff. Example is !important is overriding animations already.<br>
&lt;dael> TabAtkins: Seems to be one of the largest bits there. Distinguishable from saying layers with no importance is anyone using cascade layers couldn't override animation. HOw important is that?<br>
&lt;astearns> ack jensimmons<br>
&lt;dael> florian: Reversing your argument if people want multi layer in library to override they should create layers and !important is to go on top of the rest.<br>
&lt;florian> q-<br>
&lt;dael> jensimmons: You took conversation to where I was going. One of the underlying debates is how much do we design this new thing to be the best idea of a new thing or how much to design to deal with how authors think they understand origins and cascade and !important.<br>
&lt;dael> jensimmons: We could decide to design an API to match author current understanding and doens't require them to re-learn.<br>
&lt;florian> +1 to jensimmons<br>
&lt;dael> jensimmons: But I think we should believe that authors will learn and we can teach. It will be abreath of fresh air and people will be okay. THe story will be clear. This was old cascade, this is new, and here's a new meaning. I think it will be fine.<br>
&lt;dael> jensimmons: We shouldn't worry and think about if we can jump 10 years ahead when authors know what they're doing, what is the ideal.<br>
&lt;fantasai> jensimmons++<br>
&lt;astearns> ack dbaron<br>
&lt;dael> jensimmons: In this moment debating if important should go on top. It could be useful to them. I think think this is a big enough change that it will lead to a new understanding.<br>
&lt;dael> dbaron: I wanted to throw an idea out. TabAtkins was talking about what would happen if we didn't have !important. Some discussion about what people would do to get it. One answer is custom origins could let you do what !important does today in a different way. You can say these rules are where !important use to be in the old way.<br>
&lt;jensimmons> I agree with dbaron — and want to say it's super interesting to think about not having !important anymore. (sort of). Or doubling down on it &amp; making it work still....<br>
&lt;dael> florian: Depends on specific of proposal. What I find hard to do is in world where you set !important you don't know how many layers there will be becuase you haven't been placed. Beauty of the model is whereever you end up your !important is on the other side<br>
&lt;dael> fantasai: We have inverted order for scoped style so being consistant is good because it helps reinforce. We have it for origins and scoping, we should have it for layers.<br>
&lt;dael> myles: Wonder if you could use TabAtkins idea of no !important allowed if we allow negative orderings o if you're in L3 you can also control level -3 and put things there. Allows both worlds<br>
&lt;dael> florian: Put rules in negative of self or negative whatever you choose?<br>
&lt;dael> myles: Former<br>
&lt;dael> florian: How different from !important?<br>
&lt;dael> myles: From impl pov it's a collection of layers. It has simplicity I assume TabAtkins looking for<br>
&lt;dael> astearns: Building on myles instead of haveing ! mean invert we can have explicit teachable syntax that says whereever this layer goes the rule is in the inverse. We can come up with something better than !important syntax<br>
&lt;dael> jensimmons: Makes me think it's hard to answer this until we have other answers like is there nesting rules, how are they layers declared- list or numbers or link tag? What's the other parts. Than do we need !important?<br>
&lt;dael> jensimmons: I think the idea of getting rid of it is fascinating. Or we realize that to keep things simple we need it.<br>
&lt;dael> jensimmons: I think people will need a way to do use case of !important. Override animation or shift bootstrap 17 under but a couple you need above.<br>
&lt;dael> jensimmons: Maybe we need it going forward but not in !important syntax. Hard to know without knowing how other part looks<br>
&lt;dael> miriam: I agree there's a need to escape your layer. That's a strong use case to say this one style is required for this to work so you have to go to extra effort to override it which is what !important is for.<br>
&lt;dael> astearns: Not hearing consensus, I suggest we keep this open and work on a syntax where we can have examples and try out the use cases in a syntax.<br>
&lt;dael> astearns: Sound alight?<br>
&lt;dael> TabAtkins: Yep<br>
&lt;dael> jensimmons: Great discussion; fascenating.<br>
&lt;miriam> very, thank you all!<br>
&lt;dael> astearns: Yep, cool stuff. Great this is being considered.<br>
&lt;dael> astearns: Anything else on cascade layers?<br>
&lt;fantasai> +1 to miriam's use case<br>

GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4971#issuecomment-628115258 using your GitHub account
Received on Wednesday, 13 May 2020 16:51:26 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:42:06 UTC