-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Should <button> have user-select: none;
by default?
#8228
Comments
If we're OK with the inconsistency between the two elements, then the simplest proposal here is to just make button selectable and input not-selectable, and then only the { Gecko, button } case has to change. I don't think consistency here is especially important, but maybe someone feels differently. So far the evidence seems to be that a single web developer noticed the inconsistency and filed bugs on both Blink and WebKit. |
The Blink/WebKit behavior isn't a matter of "just" making the button selectable. To put that behavior in the spec, the spec would need to explain what Blink and WebKit do to make mouse events on the button press the button instead of starting a selection. OTOH, the Gecko approach of consistency between input and button makes sense. The page referred to in in the Gecko bug report via webcompat/web-bugs#102132 doesn't show a legitimate use case: The page is self-inconsistent and I can't infer why it is using the |
Agreed. On the user side, on the other hand, with this specific case, the selection of the content is useful.
And the good question from @hsivonen
Currently on Safari, I didn't find any key combination which is working when the cursor is above the button for selecting the text. The selection is working only if the selection starts outside of the button. |
And I think that is rather weird behavior. One may select the text, but clearing the selection doesn't work the normal way by just clicking the selection. One has to click outside the button. That is at least the behavior in Chrome. |
Let's take another example. Maybe more obvious. Let's say we have a form, and you have selected all the options. You might want to select everything and paste to keep memories of the choices.
Results:
not very consistent. |
Note the css-ui spec includes (just before the inline issue) the following:
|
This comment was marked as spam.
This comment was marked as spam.
https://bugs.webkit.org/show_bug.cgi?id=244448 rdar://99262559 Reviewed by NOBODY (OOPS!). In the section 6.1. Controlling content selection had this recommendation for the UA stylesheet for HTML. button, meter, progress, select { user-select: none; } https://drafts.csswg.org/css-ui/#content-selection seeAlso whatwg/html#8228 This will need to be unprefixed once Bug 208677 is fixed https://bugs.webkit.org/show_bug.cgi?id=208677 * LayoutTests/accessibility/mac/search-predicate-from-ignored-element-expected.txt: * LayoutTests/accessibility/mac/search-predicate-from-ignored-element.html: * LayoutTests/accessibility/mac/textmarker-range-for-range-expected.txt: * LayoutTests/editing/pasteboard/paste-noscript-expected.txt: * LayoutTests/editing/pasteboard/paste-noscript-xhtml-expected.txt: * Source/WebCore/css/html.css: (button, meter, progress, select):
Any update on this issue? As comment pointed out above, this is already specced in css-ui. It would be great to have interoperability across browsers. I am happy to help implement this in Blink. |
I forget exactly everything that was discussed at WHATNOT, but there would be risk of breakage if chrome puts user-select:none on buttons. There could be use cases where users expect to be able to select text on buttons either by clicking from outside and dragging over the button or by selecting all by pressing ctrl+a. Websites can probably see it too by executing editing commands. If we did the work to change to user-select:none, we would probably just find evidence of people wanting user-select:auto in regression bugs. If that is motivating to implement user-select:auto in firefox, then we could give it a try. I agree that the behavior in chrome and webkit is kind of magic in the way that it doesn't allow selections that start when the user clicks inside the button, but I don't think that is a great justification for changing chrome to user-select:none. If diving into the code to explain how this works would also help motivate firefox to implement user-select:auto on buttons, then we can help with that too. |
Additional comment on WebKit/WebKit#10017 (comment) for the WebKit project
|
Just a drive by comment to say that imo
I left a comment on the CSS issue for this with what I found across browser styles relative to the CSS-UI spec w3c/csswg-drafts#9709 (comment) I do think we should strive for interopability (and consistency) here. |
The way I would expect this to be sliced:
|
Opening because there are different behaviors across WebKit, Blink and Gecko.
Selectable in WebKit and Blink, but not in Gecko
Not selectable in WebKit, Blink and Gecko.
The text was updated successfully, but these errors were encountered: