codyhouse / codyhouse-framework

A lightweight front-end framework for building accessible, bespoke interfaces.
https://codyhouse.co/
MIT License
1.16k stars 172 forks source link

Use the `aspect-ratio` property. #109

Open peiche opened 3 years ago

peiche commented 3 years ago

The aspect-ratio property has support across all major browsers. Since CodyFrame v3 has dropped support for IE, I propose it adopts proper aspect ratio implementation, as opposed to the padding hack. Cheers!

sebastiano-guerriero commented 3 years ago

Hi Paul, we're still looking into this because 1. support is not that great yet (e.g., aspect-ratio is not supported in iOS < v15, which is about 10% according to caniuse), and 2. it would be great if the new classes are somehow 'compatible' with the old ones - not sure if possible. Anyway, this is def on our radar 👍

peiche commented 2 years ago

Hi @sebastiano-guerriero, thanks for the feedback. I just added the fallback again for browsers that don't support the property natively. (Props to CSS Tricks for providing the @supports logic.)

sebastiano-guerriero commented 2 years ago

Hi @peiche! I've run many tests based on your suggestion. Here are the results:

In the future, probably the best approach would be renaming the current classes to something like .media-wrapper-{ratio} and use the aspect-ratio property for the `.aspect-ratio-{ratio}' classes - with no fallback.

Any feedback is welcome.