Closed Bug 1783641 Opened 2 years ago Closed 2 years ago

Deleting a word doesn't eliminate the space around it

Categories

(Core :: DOM: Editor, defect, P3)

defect

Tracking

()

RESOLVED FIXED
108 Branch
Tracking Status
firefox108 --- fixed

People

(Reporter: edgar, Assigned: jjaschke)

References

Details

(Keywords: parity-chrome, parity-safari)

Attachments

(1 file, 1 obsolete file)

(filed from https://bugzilla.mozilla.org/show_bug.cgi?id=1779913#c7)

STR:

  1. Write "one two".
  2. Double click the word "one", then press delete.

Actual result:
The space between the words is not deleted in Firefox

Expected result:
Chrome and Safari deletes the space between the words.

See Also: → 1779913

On Mac, when I double click the word "one", the space between "one" and "two" isn't selected.
One Win11, the space is selected.

Hi Jan, would you like to take a look to see what's up in our code? Thanks.

Flags: needinfo?(jjaschke)
Assignee: nobody → jjaschke
Status: NEW → ASSIGNED
Flags: needinfo?(jjaschke)

If HTMLEditor extends the deleting range, it will need to manage InputEvent.getTargetRange() result too. Or the other browsers could be that they just forget to convert the white-space to NBSP. Investigate how they work for these things.

And also check the case white-space:pre.

This is a WIP commit, currently only contains a test to reproduce the issue.

I tested comment #0 on Linux, Chrome doesn't deletes the space between the words.

Attachment #9294286 - Attachment description: WIP: Bug 1783641: Deleting a selected word deletes surrounding whitespace. r=masayuki → Bug 1783641: Deleting a selected word deletes surrounding whitespace on MacOS. r=masayuki

Native behaviour on MacOS dictates one whitespace being removed after double-clicking a word and pressing delete.
This behaviour is achieved by saving the information that the selection is created by doubleclick to the nsFrameSelection
and using it in the DeleteRangeTransaction, where the range is extended by one whitespace character before or after the range.

Attachment #9294286 - Attachment is obsolete: true
Pushed by jjaschke@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/bdbed5920aeb
Deleting a selected word deletes surrounding whitespace on MacOS. r=masayuki
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 108 Branch
QA Whiteboard: [qa-108b-p2]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: