New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 740685 link

Starred by 2 users

Issue metadata

Status: WontFix
Owner: ----
Closed: Oct 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Dynamic changes in text input values are not registered by the undo history.

Reported by manuelch...@gmail.com, Jul 10 2017

Issue description

Chrome Version       :  59.0.3071.115 (Official Build) (64-bit)
URLs (if applicable) : N/A
Other browsers tested: N/A

What steps will reproduce the problem?
(1) Change the value dynamically on a text input.
(2) Try to use undo normally.

What is the expected result?
   Undo takes into consideration the dynamic changes.
   
What happens instead?
   Undo doesn't take into consideration the dynamic changes.

Here's a fiddle https://jsfiddle.net/apb5jrq3/2/

I understand this might be on purpose to avoid other issues. But at least on an application I'm developing, the way this works is problematic, since I change a lot of the inputs programatically, and the undo won't work properly when the user wants to revert a change.
 

Comment 1 by woxxom@gmail.com, Jul 11 2017

This is working according to specification AFAIK. The solution is to focus the element and use document.execCommand('insertText', false, 'foo'), there's also 'insertHTML' for contentEditable elements and other commands. 
Yeah insertText works indeed. I guess this is not a problem, except that the input has to be focused which may cause issues in some applications.
This is working in current Firefox. Using Firefox, in the fiddle click the Erase button to change the value. Now make an undo. The text is restored. https://jsfiddle.net/z8a9exep/
It seems it only works if the undo is done while the textarea is focused though. And could be a side effect of other feature as well.

Comment 5 by hdodda@chromium.org, Sep 29 2017

Cc: hdodda@chromium.org
Labels: Needs-Milestone Needs-Feedback
@ manuelchaves-- Thanks for reporting the issue . Could you please confirm if you could reproduce the issue on latest stable M61 #61.0.3163.100.

Thanks!
@hdodda-- It now undos indeed. Although it seems to do it in chunks, like undo everything I typed or erased in a single chunk instead of per letter, even if taking some time between typing the letters. Not a problem in my case, since I ended up using the exec undo in my application.
Project Member

Comment 7 by sheriffbot@chromium.org, Sep 30 2017

Labels: -Needs-Feedback
Thank you for providing more feedback. Adding requester "hdodda@chromium.org" to the cc list and removing "Needs-Feedback" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Cc: pnangunoori@chromium.org
Labels: Needs-Feedback
@manuelchaves -- Can we close this issue based on the Comment#6.

Thanks!
Components: Blink>Editing

Comment 10 by yosin@chromium.org, Oct 30 2017

Components: -Blink>Editing Blink>Editing>Command
Status: WontFix (was: Unconfirmed)
Mark WontFix since this is work as expected.
Undo/Redo stack records only changes of Document#execCommand, including typing.

Sign in to add a comment