Skip to content

@apply with custom classes and focus in shared class don't work #2815

Closed
@ryanw3b3r

Description

@ryanw3b3r

Describe the problem:

When I create a .button class and .button-yellow that extends .button, as soon as I add focus: to .button class, TailwindCSS removes padding. Moving focus: to .button-yellow class fixes it. Why?

I would expect focus: to work either way.

Error - no padding:

.button {
  @apply rounded-xl px-6 py-2 hover:text-white focus:border-opacity-100;
}

.button-yellow {
  @apply button bg-yellow-600 text-gray-200;
}

Good - padding is in:

.button {
  @apply rounded-xl px-6 py-2 hover:text-white;
}

.button-yellow {
  @apply button bg-yellow-600 text-gray-200 focus:border-opacity-100;
}

Link to a minimal reproduction:

Tailwind Play example

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions