button text-content cannot be selected (even in select-all)
Categories
(Core :: Layout: Form Controls, defect)
Tracking
()
People
(Reporter: dholbert, Assigned: salipov)
References
Details
(Keywords: webcompat:platform-bug)
User Story
user-impact-score:900
Attachments
(6 files, 1 obsolete file)
STR:
- Load attached testcase.
- Select-all (or click and drag to select from "Before" to "After")
- Look visually at what's selected.
- For good measure, copy-to-clipboard and paste elsewhere to see what the copied selection contained.
ACTUAL RESULTS:
Selection (and pasted output) does not include the button text.
EXPECTED RESULTS:
Selection (and pasted output) should probably include the button text.
Firefox gives ACTUAL RESULTS (in current Nightly 146.0a1 as well as very old Nightlies e.g. 2016-02-27 v47.0a1)
Current Chrome/Safari give EXPECTED RESULTS, as do old versions that I tested (Chrome 70 and Safari 13.1)
This seems to be the root cause of bug 1990445 (which involves selection by long-pressing on Android -- but I think it boils down to essentially this same "is the text selectable" question on Desktop)
| Reporter | ||
Comment 1•11 months ago
|
||
If I give the button user-select: text, as in this variant of the testcase, then the STR give EXPECTED RESULTS in Firefox.
But this isn't a perfect reference for the interoperable behavior of the original testcase. In this variant, user-select: text also lets me click and drag inside the button to select just a portion of the button-text (in Chrome and Firefox at least) -- and that's not what any browser does on testcase 1.
| Reporter | ||
Updated•11 months ago
|
| Reporter | ||
Comment 2•11 months ago
•
|
||
It looks like this is because we have user-select: none on buttons.
https://searchfox.org/firefox-main/rev/cb52781342cc905eda923d009fc0b678f3a8c8c6/layout/style/res/forms.css#486-488,499
button,
::file-selector-button,
input:is([type="color"], [type="reset"], [type="button"], [type="submit"]) {
...
user-select: none;
If I explicitly specify user-select: none on the button in the testcase, then other browsers switch to match our behavior.
So the issue here is largely that we have user-select: none; on buttons whereas other browsers do not.
| Reporter | ||
Comment 3•11 months ago
|
||
| Reporter | ||
Comment 4•11 months ago
|
||
We've got the same behavior-difference for select as well. At least in that case, our user-select: none styling is explicitly backed up by the HTML standard:
https://html.spec.whatwg.org/multipage/rendering.html#the-select-element-2
The following styles are expected to apply to select elements when they are being rendered as a drop-down box with base appearance:
select { [...] user-select: none;
I wonder why the html standard says that for select but not button...
Updated•11 months ago
|
| Reporter | ||
Comment 5•7 months ago
|
||
It looks like our decl here for button dates back to ~2000-era, without any explanation or grounding in spec text, so maybe it's just legacy cruft that we can remove...
| Reporter | ||
Comment 6•7 months ago
|
||
I'll give that a try, given that this is now known to affect impact user experience on two prominent sites (x.com and youtube.com).
Updated•7 months ago
|
| Reporter | ||
Comment 7•5 months ago
|
||
Reassigning to salipov.
Tentatively, the steps here are:
(1) Remove the user-select: none; line of CSS linked in comment 2
(2) Recompile Firefox and make sure the testcases change behavior
(3) Decide whether we should do the same for select (see whether other browsers have user-select: none on that element
(4) Probably add a WPT test to check that getComputedStyle(someButton).userSelect is auto for an unstyled button.
And this will result in a better experience for Firefox-for-Android users on x.com and youtube.com, per blocked bugs. \o/
| Assignee | ||
Comment 8•5 months ago
|
||
Removing the user-select: none; line does indeed make the buttons selectable by default, so that should be a valid fix.
I also did some digging and <select> elements don't have any working user-select functionality in Firefox, while in Chromium it seems to behave as though it has user-select: all;. I expect this should be a separate bug?
Writing a WPT will take me a while as I am quite new to this.
Comment 9•5 months ago
•
|
||
FWIW, in the user-select spec:
The following additions are made to the UA stylesheet for HTML:
button, meter, progress, select { user-select: none; }
... But then again, bug 1990445 tells us that's maybe not interoperable.
See also: https://github.com/w3c/csswg-drafts/issues/9709
| Reporter | ||
Comment 10•5 months ago
•
|
||
(In reply to Seva Alipov from comment #8)
Removing the
user-select: none;line does indeed make the buttons selectable by default, so that should be a valid fix.
Rather than removing that line, I suspect we want to move it to a new CSS rule there, that has almost the same list of selectors, except not button.
(For other non-button button-flavored form-fields whose text is a browser-applied label -- e.g. <input type="submit"> -- it makes sense that the text shouldn't be selectable by default, I think; and that seems to match other browsers as described in https://github.com/w3c/csswg-drafts/issues/9709#issuecomment-2041439088 )
I also did some digging and
<select>elements don't have any working user-select functionality in Firefox, while in Chromium it seems to behave as though it hasuser-select: all;. I expect this should be a separate bug?
That definitely seems like something to spin off to a separate bug, yeah. (Probably less pressing, since we're not aware of sites depending on it.) Thanks!
| Reporter | ||
Comment 11•5 months ago
|
||
(let me know if you'd like me/David to file the select bug. I'll defer to you since you found it and maybe it's a good learning-the-ropes exercise to file a new bug with a testcase & steps-to-reproduce. :) )
| Assignee | ||
Comment 12•5 months ago
|
||
| Assignee | ||
Comment 13•5 months ago
|
||
Updated•5 months ago
|
| Comment hidden (obsolete) |
Comment 15•2 months ago
|
||
Comment 16•2 months ago
|
||
Comment 17•2 months ago
|
||
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/61773 for changes under testing/web-platform/tests
Comment 19•2 months ago
|
||
Backed out for causing browser failures at browser_text_selection.js
Backout link
Push with failures
Failure log(s)
Comment 20•2 months ago
|
||
Interesting, likely is generating an additional AXSelectedTextChanged event that we need to handle around here.
Upstream PR was closed without merging
Updated•2 months ago
|
Comment 23•2 months ago
|
||
Comment 24•2 months ago
|
||
Comment 25•2 months ago
|
||
Backed out for causing mochitest failures @ browser_text_selection.js
Comment 26•2 months ago
|
||
Upstream PR was closed without merging
| Assignee | ||
Updated•2 months ago
|
Comment 28•2 months ago
|
||
| bugherder | ||
Comment 29•2 months ago
|
||
Did you want to nominate this for the Fx155 relnotes? If so, set the relnote-firefox flag to "?"
https://wiki.mozilla.org/Release_Management/Release_Notes_Nomination
Possible wording:
Fixed text inside buttons not being selectable or copyable, which prevented copying direct messages on X and comments on YouTube.
Upstream PR merged by moz-wptsync-bot
Upstream PR merged by moz-wptsync-bot
| Assignee | ||
Comment 32•2 months ago
|
||
Release Note Request (optional, but appreciated)
[Why is this notable]: Fixed text inside buttons not being selectable or copyable, which prevented copying direct messages on X and comments on YouTube.
[Affects Firefox for Android]: Yes
[Suggested wording]: Fixed text inside buttons not being selectable or copyable, which prevented copying direct messages on X and comments on YouTube.
[Links (documentation, blog post, etc)]:
Updated•2 months ago
|
Description
•