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

why aren't the native css "text-align: start" and end used? #39

Open
EmeraldSnorlax opened this issue Nov 20, 2021 · 3 comments
Open

why aren't the native css "text-align: start" and end used? #39

EmeraldSnorlax opened this issue Nov 20, 2021 · 3 comments

Comments

@EmeraldSnorlax
Copy link

EmeraldSnorlax commented Nov 20, 2021

the current implementation doesn't work when aligning text to the start or the end based on direction. the rules seem to conflict with each other.

what's the reasoning behind using this:

const utilities = () => ({
  '[dir="rtl"] .text-start': { 'text-align': 'right' },
  '[dir="rtl"] .text-end': { 'text-align': 'left' },
  ':not([dir="rtl"]) .text-end': { 'text-align': 'right' },
  ':not([dir="rtl"]) .text-start': { 'text-align': 'left' },
});

module.exports = utilities;

when surely this will suffice?

  '.text-start': { 'text-align': 'start' },
  '.text-end': { 'text-align': 'end' },

see these videos

Peek.2021-11-20.14-38.mp4
Peek.2021-11-20.15-00.mp4

im not sure if this is related to #25, but it seems like it might be

as a work around, ive put this in my Tailwind.postcss file:

@tailwind base;
@tailwind components;
@tailwind utilities;
  
@layer utilities {
  .text-start {
    text-align: start !important;
  }
  .text-end {
    text-align: end !important;
  }
}
@EmeraldSnorlax EmeraldSnorlax changed the title use text-align: start and end instead of swapping text direction with rtl why aren't the native css "text-align: start" and end used? Nov 20, 2021
@brahimbim
Copy link

brahimbim commented Dec 8, 2021

Hello I can fix that by adding body element before :not()
'body:not([dir="rtl"]) .text-end': { 'text-align': 'right' },

Note: it is necessary to add dir attribute in the body element

@20lives
Copy link
Owner

20lives commented Feb 5, 2022

hi, sorry for the late responese.
CSS logical properties are not widely supported by browsers yet.

since both give the same expected results I can guess it's fine to keep it that way.

maybe I can add a configuration flag to use the logical properties instead.

@bakura10
Copy link

Next version of Tailwind have native utiltiies for text-align, so maybe this can be removed from this package? In all cases, text-align start/end are supported since a very long time (according to CanIUse, Safari 3, so maybe it is safe to remove at least this one :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants