Skip to content

"Upgrade guide > Buttons use the default cursor" uses incorrect CSS selector #2460

@julesnuggy

Description

@julesnuggy

In your upgrade guide, in the section for overriding Tailwind V4's new cursor: default default setting, you suggest adding the following:

@layer base {
  button:not(:disabled),
  [role="button"]:not(:disabled) {
    cursor: pointer;
  }
}

However, [role="button"]:not(:disabled) is incorrect/inaccurate because non-form elements do not have the concept of disabled (and thus the :disabled pseudo-class will not apply to them). You would only use role=button on an element such as a <div>, so whilst this selector will technically work, it's not accurate because a <div> should never have disabled/:disabled, and you should instead be using aria-disabled

So, technically, the recommended CSS should be:

@layer base {
  button:not(:disabled),
  [role="button"]:not([aria-disabled=true]) {
    cursor: pointer;
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions