Closed Bug 2039690 Opened 1 month ago Closed 1 day ago

Firefox selects button-text when you click-and-drag inside of buttons (if they have 'user-select:auto')

Categories

(Core :: Layout: Form Controls, defect)

defect

Tracking

()

RESOLVED FIXED
154 Branch
Tracking Status
firefox154 --- fixed

People

(Reporter: dholbert, Assigned: dshin)

References

(Blocks 2 open bugs)

Details

Attachments

(4 files)

Attached file testcase 1

STR:

  1. Load attached testcase (which has some buttons with user-select:auto).
  2. Click inside the buttons and drag across the text.

ACTUAL RESULTS:
Text gets selected.

EXPECTED RESULTS:
Text should probably not get selected (because it's confusing if you were really just trying to click the button)

Note, Chrome lets you select the text if you click outside the button and drag across the button. But they don't let you select text if you start your click inside the button.

We probably need to fix this before we can make user-select:auto the default style for buttons in bug 1998331 (which we have webcompat reasons to want to do, as noted there).

Be careful about the editable case. Chrome allows to select and edit the text in <button>.

(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900)(PTO: 5/2-5/10) from comment #2)

Be careful about the editable case. Chrome allows to select and edit the text in <button>.

Thanks, good callout. In contenteditable, specifically for <button> (first part of testcase 2), Chrome does indeed let you click-and-drag-within-the-button to select text, but only if your initial click is in the text part of the button (as opposed to the padding).

That seems to match how Firefox currently behaves for <input type="button"> (regardless of contenteditable), actually!

For true <button> (first part of testcase 1 and testcase 2), Firefox lets you click the padding-top and drag down to the padding-bottom, and select all the text in between.

The severity field is not set for this bug.
:alaskanemily, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(emcdonough)
Severity: -- → S3
Flags: needinfo?(emcdonough)
Assignee: nobody → dshin
Status: NEW → ASSIGNED
Blocks: 2053298
Pushed by dshin@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/df2bdd880266 https://hg.mozilla.org/integration/autoland/rev/22e4f438ffe2 Prevent text selection from originating inside a button-like element for user-select: auto. r=layout-reviewers,emilio

Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/61141 for changes under testing/web-platform/tests

Status: ASSIGNED → RESOLVED
Closed: 1 day ago
Resolution: --- → FIXED
Target Milestone: --- → 154 Branch

Upstream PR merged by moz-wptsync-bot

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: