ItsJonQ / g2

✨ An experimental reimagining of WordPress components
http://g2-components.com/
MIT License
105 stars 12 forks source link

UnitInput: Fix unit change for zero values #254

Open ItsJonQ opened 3 years ago

ItsJonQ commented 3 years ago

It looks like UnitInput is unable to handle unit changes for values like 0px -> 0vh

aristath commented 3 years ago

Why should it handle them? Changing units when the value is 0 doesn't really change anything... 0px is the same as 0% and 0em :thinking:

ItsJonQ commented 3 years ago

Great question! The rendered value doesn't change (CSS wise). However, I think the UI feels broken if I (the user) manually typed a change from 0px or 0vh. Or worse... used the unit selector to change from 0px to 0vh.

Neither methods work at the moment 🙈

https://g2-components.xyz/iframe.html?id=components-unitinput--default&viewMode=story