-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Buttons have cursor: pointer by default, but should not for accessibility reasons #8961
Comments
This is a pretty common expectation but as outlined in in #8961 isn't really right. We considered this a long time ago but it felt too against the grain at the time. These days though very UI-forward applications like [Linear](https://linear.app/) are using the default cursor for buttons and I think this trend will continue as more people become aware that `cursor: pointer` is meant for links. Let's update our defaults here to help nudge people in this direction and make it more common. If people want to change this in their own apps, it's just a line or two of CSS to add to their projects.
Yeah agree this is the right default, changing in #8962. Going to put this out in a patch or minor, doesn't really feel "breaking" to me. |
* Don't use `cursor: pointer` for buttons by default This is a pretty common expectation but as outlined in in #8961 isn't really right. We considered this a long time ago but it felt too against the grain at the time. These days though very UI-forward applications like [Linear](https://linear.app/) are using the default cursor for buttons and I think this trend will continue as more people become aware that `cursor: pointer` is meant for links. Let's update our defaults here to help nudge people in this direction and make it more common. If people want to change this in their own apps, it's just a line or two of CSS to add to their projects. * Update changelog Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
@adamwathan Should this be re-opened since #8962 was reverted in 0a3aad9?
|
I second @diegohaz, this should be reopened. |
Any plans to revisit this? |
Buttons should not have
@thecrypticace Could this issue be reopened? |
The In the meantime, I’ve added this to a codebase that uses TailwindCSS v3: @tailwind base;
@tailwind components;
@tailwind utilities;
@layer base {
/*
* TODO: Remove after upgrading to Tailwind CSS 4.0+
* Context: https://github.com/tailwindlabs/tailwindcss/issues/8961
*/
button,
[role='button'] {
cursor: default;
}
} |
Related to #8961 and #8962 Before v4, buttons got this CSS in preflight: https://github.com/tailwindlabs/tailwindcss/blob/9824cb64a03afaa405e184cb31003c8a1efafaa7/src/css/preflight.css#L339-L353 v4 (`next` branch) no longer has `cursor: pointer` in [preflight.css](https://github.com/tailwindlabs/tailwindcss/blob/2fe249963583e436961adc59cf9988af454e3da5/packages/tailwindcss/preflight.css) This PR removes additional CSS for `:disabled` buttons. It was meant to undo an override that is no longer present.
What version of Tailwind CSS are you using?
3.1.6
What build tool (or framework if it abstracts the build tool) are you using?
Vite 3.0.0 (rollup)
What version of Node.js are you using?
v16.13.0
What browser are you using?
Chrome
What operating system are you using?
macOS
Reproduction URL
https://stackblitz.com/edit/react-tailwind-qds1vc?file=index.js
Describe your issue
While it's common to give
<button>
scursor: pointer;
, this is an anti-pattern. The CSS spec establishes thatcursor: pointer
indicates an element is a link.This article has some additional justification for this. I understand many users will want to override this behavior back to the common misuse of
cursor: pointer;
, but Tailwind should be correct by default.The text was updated successfully, but these errors were encountered: