You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently stumbling on a problem I have (and had before may times with vanilla CSS) with transitions (or also transform or other comma separated properties):
Problem
I want to create a focusable utility. It is like the built in focusRing utility, but it also sets transition for outline-offset and outline-color. Applying it would overwrite the other transitions.
So far I solved it with a pattern and passing additional transitions to it using it like this:
The pattern transform function would then handling merging the transitions.
But this means I need to know the transition beforehand. If I would have another pattern or another utility that would set transitions, I can't do that.
Other alternative would be to set transition to all, but then it would do transitions on properties I don't want to do transition on and I can't have different speeds for different properties.
Suggestion
Have the possibility to define that a style would extend transition instead of replacing it.
It would also be nice, if this would work inside utility. Maybe there could be suffixed/named, so the transitions property wouldn't be overwritten when merged with other style objects.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I'm currently stumbling on a problem I have (and had before may times with vanilla CSS) with transitions (or also transform or other comma separated properties):
Problem
I want to create a
focusable
utility. It is like the built infocusRing
utility, but it also sets transition foroutline-offset
andoutline-color
. Applying it would overwrite the other transitions.So far I solved it with a pattern and passing additional transitions to it using it like this:
The pattern
transform
function would then handling merging the transitions.But this means I need to know the transition beforehand. If I would have another pattern or another utility that would set transitions, I can't do that.
Other alternative would be to set transition to
all
, but then it would do transitions on properties I don't want to do transition on and I can't have different speeds for different properties.Suggestion
Have the possibility to define that a style would extend transition instead of replacing it.
This would then merge the transition value to this:
It would also be nice, if this would work inside utility. Maybe there could be suffixed/named, so the transitions property wouldn't be overwritten when merged with other style objects.
Could also be done with a property creation function that exposes a
Symbol
and memoizes it with the right name:Beta Was this translation helpful? Give feedback.
All reactions