Skip to content
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

logical css properties seems not to resolve when conflicting with normal css properties #388

Open
lord007tn opened this issue Mar 5, 2024 · 1 comment
Labels
context-v2 Related to tailwind-merge v2

Comments

@lord007tn
Copy link

Describe the bug

When having a logical property like ps-2 and we add to it pl-4 they don't resolve and the two values are printed
as mentioned down in the pull request of shadcn-vue

To Reproduce

radix-vue/shadcn-vue#379 (comment)

Expected behavior

twMerge('pl-4', 'ps-6') ---> pl-4 ps-6 (directional + logical) the expected result should be ps-6 only as it come later
twMerge('pl-4', 'pl-6') ---> pl-6 (directional + directional)
twMerge('ps-4', 'ps-6') ---> ps-6 (logical+ logical)

@dcastil dcastil added the context-v2 Related to tailwind-merge v2 label Mar 5, 2024
@dcastil
Copy link
Owner

dcastil commented Mar 5, 2024

Hey @lord007tn! 👋

tailwind-merge doesn't resolve conflicts between normal and logical properties because it doesn't have access to the axis along which logical properties are being applied. This axis is dynamic and can be different for any node in the DOM.

E.g. ps-6 (applying the padding-inline-start property) would be in conflict with pl-4 without any other properties being set. But if a parent node applies the CSS direction: rtl, ps-6 wouldn't be in conflict with pl-4 anymore because ps-6 then gets applied to the right side instead. And if additionally writing-mode: vertical-lr is applied (to a parent), ps-6 gets applied to the bottom of the node.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
context-v2 Related to tailwind-merge v2
Projects
None yet
Development

No branches or pull requests

2 participants