-
Notifications
You must be signed in to change notification settings - Fork 10.6k
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
[role="button"] should be styled with cursor:pointer #371
Comments
I like the idea. But would be weird to have a [type='text']:active {
cursor: text;
} Anyhow... I'm not sure this would cut it. |
Hi Thierry, label[for],
input[type=radio],
input[type=checkbox],
button,
input[type=reset],
input[type=button],
input[type=submit] {
cursor: pointer;
}
input[type=file]::-webkit-file-upload-button {
cursor: pointer;
} |
@7studio: 👍 |
@7studio @battaglr I agree that my example is too broad, but the issue was really open for I do not see the need to use Also, why going for I think in my next project I'll go with something like this:
|
@thierryk: good point about the |
@thierryk I use |
This would also be useful with working around Safari Mobile's element clickability issue, so long as you're accessibility-minded enough to have added the |
Trying to think about any times you wouldn't want |
Please don't do this. This seems contrary to the goals of normalize.css (as I understand it: improving consistency, not changing standard behaviors). On this topic, web browsers are fairly consistent:
The concept for links is that they take you to a different URL. The hand cursor (pointer) indicates that. Buttons don't take you to a different URL (with the notable exception of form submit buttons, though this is less true with scripted or HTML5-validated forms), and thus don't have this style. Specification
Declaring UI conventionsDesktop OSes and applications use a default/arrow cursor for most things. They use a pointer/hand cursor for hyperlinks only. Menu bars, toolbar menus, buttons, all use the default pointer. They don't use the hand (hyperlink) cursor to denote actionable items, but a number of interaction design elements, such as:
There are rare exceptions. More interestingly, there's a gray area where a button or menu entry takes the user to a different view or "location". For instance in the Windows file explorer, the locations in the left sidebar use a hand cursor, possibly because a) they take the user "somewhere else" and b) they're activated with a single click. Files, folders and links-to-files-or-folders in the main view use a default cursor. Implementations can be a bit inconsistent. They tend to be 95% right or better in desktop OSes and apps, but much more inconsistent in web applications. Web antipattern: everything is a "link"On the web it gets a little bit murky as in the good old days of Ajaxified interfaces, developers would often use the Some web applications ended up with 90% of actionable items showing a pointer/hand cursor, i.e. showing the cursor for hyperlinks, even though most of those items behaved as buttons, not as hyperlinks. There are examples of applications not using this antipattern, though. For instance, the current Gmail UI gets its button-vs-links mostly right (understanding links as "switch to a different view"). On the other hand, Github gets it mostly wrong. Beyond implementation, this is a design issue were both cursors and visual styles must be considered. Designers should probably categorize actionable items depending on what they do, and come up with styles for each category and subcategory (the two main categories should probably be "Link" and "Button"). Keeping in mind accessibility, they should also make sure that their design system maps to the right HTML (and, if needed, ARIA) semantics. What could be normalizedI'd argue that the current browser behavior is spec-compliant, and desirable. It could be reinforced further by making sure that buttons use a default cursor, with code such as: /**
* Correct cursor style for buttons
*/
[role="button"], /* explicit button semantics */
a[href="#"], a[href="#0"] /* Common patterns for the <a> element used as a button */
{
cursor: default;
} I rest my case. :) |
@fvsch even if "it is in the spec", I disagree. Most users don't know the difference between a button and a link, the cursor: pointer gives them the information that "something is going to happen when you will click on it". So that's why I use this in my CSS :
|
@fvsch I get your point, but you have to remember that on touch-only devices, the |
100% agree with @fvsch. @nico3333fr "something is going to happen when you will click on it" you'll have that with the graphic of the button. If nobody ever click on the button, you have an ergonomic issue. This shouldn't be in normalize, I think that normalize is here to NORMALIZE something not MODIFY it. If you want your a[href="#"] totally looks like a button then use button[type="button"], IMO. |
@nico3333fr I wouldn't generalize too quickly about "most users". Also if your users need a hand cursor to understand that something can be clicked (which is a very questionable premise, since desktop OSes and apps do without it just fine!), then your design is utterly broken on touch devices, and you need to fix your visual language ASAP. ;) |
@fvsch I do agree anyway, but tell this to communication agencies that make designs so "flat" that you don't recognise a button :) |
@nico3333fr so it's because designers don't know how to make a button that we have to rape HTML's semantic? Nice. 👎 |
@nico3333fr even on flat UI (eg: ios) you know where to click when you see |
@DaPo "rape HTML semantics" :o End of the troll. |
@nico3333fr don't change anything about the fact that a |
@fvsch made a few good points, but this suggestion:
seems to go against the spirit of nomalize the same way as So I'd downvote my previous suggestion even though I'll keep using this myself. As I do see the benefit of the visual cue and do not believe users associate this to links per se. After all, there are countless examples in the wild where we use |
@thierryk because we seem OK with the point of view of @fvsch, we should open a new issue for proposing to remove these two parts of normalize.css: button,
html input[type="button"], /* 1 */
input[type="reset"],
input[type="submit"] {
cursor: pointer; /* 3 */
} /**
* Re-set default cursor for disabled elements.
*/
button[disabled],
html input[disabled] {
cursor: default;
} What do you think about that? |
@7studio Yes, I agree, that makes sense to me. |
Yes let's remove some of the opinionated styles instead. |
|
Please don't spam. |
At the very least, [role="button"] should be styled with
cursor: pointer
, but I think it would make sense to style other elements the same way, for example:If
menu
was considered in nomalize, then we could also addmenuitem
in there.The text was updated successfully, but these errors were encountered: