Open Bug 1927275 Opened 4 months ago Updated 4 months ago

contenteditable still selects non-contenteditable even with user-select: none

Categories

(Core :: DOM: Selection, defect)

Firefox 131
defect

Tracking

()

Tracking Status
firefox132 --- affected
firefox133 --- affected

People

(Reporter: konnor5456, Unassigned)

References

(Depends on 1 open bug)

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:131.0) Gecko/20100101 Firefox/131.0

Steps to reproduce:

Create a contenteditable element, add a non-contenteditable inside of it, remove user-selections via CSS, focus the contenteditable, hit "CMD+A" to select all contents.

Actual results:

It selected the non-contenteditable contents.

Expected results:

It should not have selected the non-contenteditable contents.

Codepen of the issue:

https://codepen.io/paramagicdev/pen/rNXpJYm

This works as expected in Chrome 130 and Safari 17.6

Component: Untriaged → DOM: Editor
Product: Firefox → Core

Hello, thank you for the bug report!
Managed to reproduce this issue on:

  • Firefox Nightly 133.0a1;
  • Firefox 132.0;

Tested and reproduced on:

  • macOS 14;
  • Ubuntu 22;
  • Windows 10;

Setting as NEW so the developing team can have a look.

Status: UNCONFIRMED → NEW
Ever confirmed: true

Well, if it's in non-editable element, it works as expected.
https://jsfiddle.net/d_toybox/tozaqfbj/

I found the different paths for editable vs. non-editable cases.
https://searchfox.org/mozilla-central/rev/73adec8ae1089db082e350da8951b8dde7aa3bcb/dom/base/Selection.cpp#1047-1054

So, I think that this is a long standing issue depending on bug 1773065.

Severity: -- → S3
Component: DOM: Editor → DOM: Selection
OS: Unspecified → All
Hardware: Unspecified → All

I forgot to add, I sent this to a friend and they reported Firefox on Android has the same behavior as desktop where it will select non-editable / non-selectable elements if you hit "Select All"

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