-
-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setting for postcss-logical
to allow having logical properties with fallback
#892
Comments
Hey @Arkkimaagi Thanks a lot for taking the time to submit such a detailed question.
No, there's no way to do this with the current plugin.
While I agree and I see the pain this adds to your usecase, I see your point and while we were thinking about revamping While evaluating your issue something came to mind which I'm going to discuss internally before giving any hopes. We'll get back to you |
@Arkkimaagi after thinking about this thoroughly we still think we made the right move. What we were thinking is about adding some control with comments or even with [dir] {
margin-inline-start: 10px;
}
/* becomes */
[dir=ltr] {
margin-left: 10px;
}
[dir=rtl] {
margin-right: 10px;
} Or alternatively, we could not do anything magical and just interpret a parent rule with a selector that contains However, our initial thought was that If you really need to support older browsers and have mixed writing modes within the same doc, you need to do it manually. Even if we add these, our initial thought remains correct. I'm happy to change my opinion but I can't really see a clear way forward that is a good solution for all cases |
@Arkkimaagi a final note, we've tracked the issues we found with logical as we know it's a controversial change. The wiki page outlines what we found: https://github.com/csstools/postcss-plugins/wiki/PostCSS-Logical-Issues I'm hoping we can find something clever that makes this tick but so far, we don't see anything viable. |
For now we've fixed the postcss-preset-env version to 7 instead of 8 and we're waiting for fall of 2023 when iOS17 will be released. We're hoping that the use of pre iOS 15 Safari will drop to low enough percentage so that we can start using logical properties natively. 🤷 |
@Arkkimaagi You can also add the old This allows gives you the best of both for your use case :
|
Closing this because no action is planned at this time, but happy to re-open this if someone has a good suggestion on how we can avoid all the issues and have fallbacks :) |
What would you want to propose?
When we updated to postcss-preset-env 8.0.0, our logical properties broke.
We have Arabic and English content on the same page on few special content pages of 15k pages. Previously the logical properties did work with the
[dir="ltr"]
[dir="rtl"]
prefix. It was not perfect, but it did work.I went through the issues and found a few relevant, but I felt that they did not fully answer our situation:
postcss-logical
#736 looks like the one that has been implemented here, but it mentions forcing the direction being only fallback, not the only solution. Is there a way to have the logical property and the hardcoded direction both in same file with some setting we missed?preserve: true
would allow us to have a "dumb" fallback for situations when old browsers do not support logical properties. It would not work on old browsers + arabic layout, but it would not break as bad as just using pure logical properties would and it would work on two different contents on same page for most current browsers (iOS14.x is our only major group with no logical property support).So, is there some setting that would allow us with Arabic and English content on same page to use logical properties and fallback to non-logical properties either with
[dir="ltr"]
and[dir="rtl"]
or without them?Suggested solution
Some
postcss-logical
related setting that would allow having logical properties and a "dumb" fallback at the same time, so that we could have two different direction languages on same page.Additional context
No response
Validations
Would you like to open a PR for this feature?
The text was updated successfully, but these errors were encountered: