Last modified: 2014-08-28 15:39:59 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T60724, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 58724 - VisualEditor: Command-x (cut) triggers browser's Undo (Command-z) in Safari
VisualEditor: Command-x (cut) triggers browser's Undo (Command-z) in Safari
Status: RESOLVED FIXED
Product: VisualEditor
Classification: Unclassified
Editing Tools (Other open bugs)
unspecified
All All
: Low normal
: VE-deploy-2014-08-28
Assigned To: Ed Sanders
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-12-20 00:21 UTC by WhatamIdoing
Modified: 2014-08-28 15:39 UTC (History)
8 users (show)

See Also:
Web browser: Apple Safari
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Patch to prevent undo on cut (2.54 KB, patch)
2014-08-27 17:29 UTC, Aditya Bhatt
Details

Description WhatamIdoing 2013-12-20 00:21:58 UTC
Intention:
Move a section of a page by cutting it out of one place and pasting it into the right place.

Steps to Reproduce:
1.  Close an unwanted browser tab.
2.  Select several paragraphs in VisualEditor.
3.  Press Command-x to cut (not just copy) the material.
4.  Notice that the just-closed browser window has reappeared.  (Command-z/Undo in Safari reopens a tab that you just closed.)



Reproducible: Always

I am unable to reproduce this in Firefox, presumably because selecting text within VisualEditor seems to clear (or otherwise make unavailable) the 'undo' buffer.  So even if VisualEditor is telling Firefox to undo something, Firefox believes that there there's nothing to undo.
Comment 1 James Forrester 2014-08-21 17:32:48 UTC
Ick. This feels like a pretty poor browser bug here…
Comment 2 Aditya Bhatt 2014-08-27 17:29:37 UTC
Created attachment 16293 [details]
Patch to prevent undo on cut

Here's a patch that avoids the 'undo' execCommand and fixes the issue for me in Chromium 36.0.1985.125 (Linux).

I'm assuming that the timeout was originally intended to let the code in that block be safely executed only after the browser manipulated (deleted) the selection. It appears that this no longer works and the code is processed before the text is actually deleted.

Therefore this change uses preventDefault() to not let the browser do it's thing, and directly handles the entire removal with a transaction.

This is my first patch to VE, sorry if I made any obvious mistakes. :)
Comment 3 Aditya Bhatt 2014-08-27 18:40:25 UTC
Pushed a patch to gerrit. 

https://gerrit.wikimedia.org/r/#/c/156593/
Comment 4 Gerrit Notification Bot 2014-08-27 18:54:01 UTC
Change 156593 had a related patch set uploaded by Catrope:
Avoid undo when processing a cut event.

https://gerrit.wikimedia.org/r/156593
Comment 5 Gerrit Notification Bot 2014-08-27 23:56:01 UTC
Change 156733 had a related patch set uploaded by Catrope:
Avoid undo when processing a cut event.

https://gerrit.wikimedia.org/r/156733
Comment 6 Gerrit Notification Bot 2014-08-27 23:57:41 UTC
Change 156593 abandoned by Catrope:
Avoid undo when processing a cut event.

Reason:
Duplicate of https://gerrit.wikimedia.org/r/156593

https://gerrit.wikimedia.org/r/156593
Comment 7 Gerrit Notification Bot 2014-08-27 23:57:58 UTC
Change 156593 restored by Catrope:
Avoid undo when processing a cut event.

Reason:
Whoops, obviously this isn't a duplicate of itself...

https://gerrit.wikimedia.org/r/156593
Comment 8 Gerrit Notification Bot 2014-08-27 23:58:05 UTC
Change 156733 abandoned by Catrope:
Avoid undo when processing a cut event.

Reason:
Duplicate of https://gerrit.wikimedia.org/r/156593

https://gerrit.wikimedia.org/r/156733
Comment 9 Gerrit Notification Bot 2014-08-28 12:11:21 UTC
Change 156776 had a related patch set uploaded by Esanders:
Remove unnecessary execCommand('undo') from onCut

https://gerrit.wikimedia.org/r/156776
Comment 10 Gerrit Notification Bot 2014-08-28 12:49:32 UTC
Change 156776 merged by jenkins-bot:
Remove unnecessary execCommand('undo') from onCut

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

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links