bugzilla.mozilla.org has resumed normal operation. Attachments prior to 2014 will be unavailable for a few days. This is tracked in Bug 1475801.
Please report any other irregularities here.

setRangeText doesn't preserve selection after Undo

UNCONFIRMED
Unassigned

Status

()

Core
Selection
UNCONFIRMED
2 years ago
4 months ago

People

(Reporter: Sergey Rozhenko, Unassigned)

Tracking

45 Branch
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

2 years ago
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0
Build ID: 20160407164938

Steps to reproduce:

Open any page with an editable <textarea> or text <input> element. Write some text in it if there is none. Select anything (say, a word) in that element.
Write document.activeElement.setRangeText("HELLO WORLD") in the F12 console.
Press Ctrl+Z.


Actual results:

Change undone, but selection isn't preserved: whole text gets selected.


Expected results:

Text that was selected before the operation should be selected.
This is important for various forums where you need to insert BB codes, because there's currently no known way to insert text into a text area that's undo-friendly in the described sense.

Updated

2 years ago
Component: Untriaged → Selection
Product: Firefox → Core

Comment 1

4 months ago
It seems that setRangeText erases the entire history now.

Name 	Firefox
Version 	60.0b1
Build ID 	20180302190033
You need to log in before you can comment on or make changes to this bug.