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 have been converting a UI library to use rems rather than px for font sizes, heights and widths etc to make it accessible for visually impaired users. Most of the work involved finding all unitless values and wrapping them in a rems function. After doing this everything just seemed to work. This made me think it might good to be able to configure this at the library level via a mapUnitless function. Users can then choose to make rems the rule and px the exception. i.e. default to accessible.
The above Codesandbox has this feature hacked in (have a play). The cool thing about doing things in this way is that a component designed to work with rems. Will still work if the Emotion configured to use px. There may be a better way to do this what are your thoughts?
The text was updated successfully, but these errors were encountered:
Thanks for providing a really nice demo - this a great way of showcasing the problem and possible solution!
The whole idea has some problems, e.g. outlined here. At this point in time, I'm not sure how we could accommodate this along with simpler use cases (such as probably yours as you might want to use this only internally~ for your app's purposes). This is a general problem with context-based stuff - not exclusive to your problem at hand (and React is primary integration for emotion - even though there is existing vanilla flavor).
I'm going to close this issue now because it's not immediately actionable and we have sort of PoC PR for something like this (#1299). I would recommend watching this PR if you are interested in this. Hope you understand - trying to slim down opened issues.
emotion
version: anyreact
version: anyI have been converting a UI library to use
rems
rather thanpx
for font sizes, heights and widths etc to make it accessible for visually impaired users. Most of the work involved finding all unitless values and wrapping them in arems
function. After doing this everything just seemed to work. This made me think it might good to be able to configure this at the library level via amapUnitless
function. Users can then choose to makerems
the rule andpx
the exception. i.e. default to accessible.https://codesandbox.io/s/py9x54q71q
The above Codesandbox has this feature hacked in (have a play). The cool thing about doing things in this way is that a component designed to work with
rems
. Will still work if the Emotion configured to usepx
. There may be a better way to do this what are your thoughts?The text was updated successfully, but these errors were encountered: