tailwindlabs / tailwindcss

A utility-first CSS framework for rapid UI development.
https://tailwindcss.com/
MIT License
81.75k stars 4.11k forks source link

Class `ml-auto` no longer working with 3.4.5+ #14013

Closed ilkon closed 1 month ago

ilkon commented 1 month ago

With the release of version 3.4.5, the class ml-auto stopped working and is no longer recognized as CSS class.

For example I have html from this example (simplified):

<div class="flex items-center gap-x-6">
  <div>Block 1</div>
  <div class="ml-auto">Block 2</div>
</div>

The CSS class ml-auto is not recognized by tailwind and not added to the styles.css, so the last block is not aligned to the right.

What version of Tailwind CSS are you using?

v3.4.5, v3.4.6

What build tool (or framework if it abstracts the build tool) are you using?

Standalone CLI that comes with Tailwindcss-rails gem: tailwindcss-rails (2.6.3-x86_64-linux)

What browser are you using?

Tested in the latest Chrome and Firefox

What operating system are you using?

Linux (Debian 12)

adamwathan commented 1 month ago

Hey! Can you provide a reproduction? I can't reproduce this when I paste that exact HTML into a fresh project.

What does your source HTML actually look like, are you using Slim or something for the HTML?

ilkon commented 1 month ago

Hey!

Sure. Here is the page built with tailwindcss-rails v.2.6.1:

Screenshot ![Screenshot from 2024-07-17 13-46-10](https://github.com/user-attachments/assets/07916548-c95c-4c39-acb0-8a844e6d1e6f)

And here is the same page after upgrade to v.2.6.3:

Screenshot ![Screenshot from 2024-07-17 13-49-37](https://github.com/user-attachments/assets/2007bc64-a06d-452a-bc0c-5bb42792793c)

I use Slim. Here is the relevant code:

      .flex.items-center.gap-x-6
        a[class='-m-1.5 p-1.5' href=root_path]
          span.sr-only
            | Grocelio
          = render 'shared/full_logo', html_class: 'h-6 w-auto'
        .ml-auto[
          data-ui--sidebar-target='hideButton'
          data-action='click->ui--sidebar#hide'
          data-transition-enter='ease-in-out duration-300'
          data-transition-enter-start='opacity-0'
          data-transition-enter-end='opacity-100'
          data-transition-leave='ease-in-out duration-300'
          data-transition-leave-start='opacity-100'
          data-transition-leave-end='opacity-0'
        ]
          button class='-m-2.5 p-2.5 rounded-md text-gray-700'
            span.sr-only
              | Close menu
            svg.h-6.w-6[fill='none' viewbox='0 0 24 24' stroke-width='1.5' stroke='currentColor' aria-hidden='true']
              path[stroke-linecap='round' stroke-linejoin='round' d='M6 18L18 6M6 6l12 12']
Skulli commented 1 month ago

Think my bug from here has the same cause

I use haml and following code is not working:

.xl:col-span-2.xl:pr-8{class: border_classes}

but

.xl:col-span-2.xl:pr-8

without custom attributes does.

In this bug the .xl:col-span-2 is not extracted, when custom attrributes are attached. border_classes are just some classes for the border inside a variable/method.

adamwathan commented 1 month ago

Hey! This should be fixed in v3.4.7 which we released yesterday 👍

https://github.com/tailwindlabs/tailwindcss/releases/tag/v3.4.7

ilkon commented 1 month ago

Great! I confirm the bug is fixed. Thanks!

Skulli commented 1 month ago

same for me