I blug about #css again. Preventing an `!important` user agent style from kicking in with an infinite-duration transition https://noahliebman.net/2024/08/beating-important-user-agent-styles/
I blug about #css again. Preventing an `!important` user agent style from kicking in with an infinite-duration transition https://noahliebman.net/2024/08/beating-important-user-agent-styles/ 13 comments
@paultk interesting question. I donāt know, but considering how efficient CSS animations generally are, how infrequently this scenario might come up, and possible optimizations of `step` timing functions, I assume itās quite safe @noleli Iām assuming this works, because the user specified styles get applied first, because the !important of the user agent stylesheet makes it kick in last? And thatās how the initial state of the transition is set? I never thought of !important styles being applied *after* regular ones in a ātimeā sense. š @amxmln itās not a time thing, but a precedence thing. The cascade (origin, specificity, layers, etc.) determines which styles are applied. A feature of the cascade is that active transitions take precedence over everything else. Essentially itās telling something ātake forever to get to your destination even if your destination is really high priority.ā @AmeliaBR @amxmln thatās a good point. in this case, author styles are applied initially, and only once someone tries to autofill and the proprietary pseudoclass gets applied does it (try to) go to the !important UA styles. I should clarify that in my post, because this trick only works under those circumstances. @AmeliaBR totally. I may have missed it, but I didnāt see in the spec that a UA must make clear that a field has been autofilled. That said, I could imagine it being a security concern if it doesnāt. Certainly warrants more discussion with the design team. |
@noleli white kind of performance penalty would this incur?