Page MenuHomePhabricator

On a page with recovered autosaved changes, using Ctrl+Z to undo clears the DM selection (and CE selection is desync'd)
Closed, ResolvedPublic

Description

On a page with recovered autosaved changes, using Ctrl+Z to undo clears the DM selection (and CE selection is desynchronized).

The most annoying effect of this is that pressing Ctrl+Z again does nothing (until you click on the surface to focus it). It doesn't happen when editing a page normally, only if autosaved changes have been recovered on it.

Recording below shows it happening. Every time the selection becomes null, it's because I pressed Ctrl+Z to undo.

As far as the undo stack not being preserved issue, I've found that the full history is actually preserved, but for some reason, after a few Ctrl+Zs, the editor stops responding to my Ctrl+Z until I spam it several more times. Then it continues to back up through the history. Weird, but it seems to work. I don't think it's lag or anything, since undo works immediately from the current editing session, over dozens of changes.

Event Timeline

This would be fixed by T202730, as the undo stack also stores the selection after each transaction. It may be possible to fix it in other ways though, as we can guess a selection from a transaction (e.g. select the modified range).

Change 460328 had a related patch set uploaded (by Esanders; owner: Esanders):
[VisualEditor/VisualEditor@master] Allow applyTo to guess a selection for undo

https://gerrit.wikimedia.org/r/460328

This bug would be even more annoying on mobile, I can imagine...

Change 460328 merged by jenkins-bot:
[VisualEditor/VisualEditor@master] Allow applyTo to guess a selection for undo

https://gerrit.wikimedia.org/r/460328

Change 461161 had a related patch set uploaded (by Jforrester; owner: Jforrester):
[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (2093bd6f0)

https://gerrit.wikimedia.org/r/461161

Change 461161 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (2093bd6f0)

https://gerrit.wikimedia.org/r/461161