Closed Bug 1881989 Opened 4 months ago Closed 4 months ago

Text can not be deleted from a non-DIV contenteditable element under a ShadowRoot

Categories

(Core :: DOM: Editor, defect)

Desktop
All
defect

Tracking

()

VERIFIED FIXED
125 Branch
Tracking Status
firefox125 --- verified
firefox126 --- verified

People

(Reporter: james, Assigned: masayuki)

Details

Attachments

(2 files)

Attached file div_text_deletion.html

Steps to reproduce:

Attempt the following actions on the third line:

  • press Backspace or Delete with a non-collapsed selection
  • cut a text selection with ctrl-x
  • press Delete with a collapsed selection

Actual results:

The text is not deleted.

Expected results:

The text should have disappeared.

Text can still be deleted from non-DIV elements outside the ShadowRoot, or DIV elements within the ShadowRoot.

My user agent string is "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:125.0) Gecko/20100101 Firefox/125.0". The exact version is Firefox Nightly 125.0a1.

I can reproduce this issue on Nightly125.0a1 Windows10.
And I can also reproduce even on Firefox102, 90, 78. So, this does not seem to be a regression.

Status: UNCONFIRMED → NEW
Ever confirmed: true

I guess that it's caused by that there is no block ancestor of the <span> in the shadow DOM.

Assignee: nobody → masayuki
Status: NEW → ASSIGNED
Severity: -- → S3

It's currently handling its job with the closest ancestor block which may be
non-editable and editing host which is either inline or block. However, the
closest block is required for check whether the range won't be extended outside
the closest block of the common ancestor of the range and the range is
guaranteed that they are in an editing host. Therefore, it's not required if
it's outside the editing host. So, comparisons which check whether a node is
either/neither editing host or/nor ancestor block can get same result with
comparing with the closest one of the editing host or the closest editable
block.

Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/c2895c7db175
Make `AutoDeleteRangesHandler::ExtendOrShrinkRangeToDelete` handle it with the closest editable ancestor block or inline editing host r=m_kato
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/44821 for changes under testing/web-platform/tests
Status: ASSIGNED → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → 125 Branch
Upstream PR merged by moz-wptsync-bot
QA Whiteboard: [qa-125b-p2]

Reproducible on a 2024-02-25 Nightly build on Windows 10.
Verified as fixed on Firefox Nightly 126.0a1 and Firefox 125.0 on macOS 12, Windows 10, Ubuntu 22.

Status: RESOLVED → VERIFIED
QA Whiteboard: [qa-125b-p2]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: