Page MenuHomePhabricator

"Discard changes" does not discard changes for CodeEditor or CodeMirror
Closed, ResolvedPublicBUG REPORT

Assigned To
Authored By
Nardog
Dec 18 2023, 5:49 AM
Referenced Files
F41666302: CE_3.webm
Jan 11 2024, 8:03 PM
F41666301: CM_3.webm
Jan 11 2024, 8:03 PM
F41664425: CM_Discard.webm
Jan 10 2024, 11:04 PM
F41664423: CM_Discard_1.webm
Jan 10 2024, 11:04 PM
F41664422: CM_Show.webm
Jan 10 2024, 11:04 PM
F41664421: CM_Show_1.webm
Jan 10 2024, 11:04 PM

Description

Steps to replicate the issue (include links if applicable):

  • Edit a page with syntax highlighting or code editor on
  • Modify the content
  • Close the tab without saving the changes
  • Reopen the tab
  • Click "Discard changes"

What happens?:
Nothing.

What should have happened instead?:
The changes are discarded. That is, clicking "Show changes" shows "(No difference)".

Other information:
The restoration of the content should use jquery.textSelection.

QA Results - Beta

Event Timeline

Restricted Application added a subscriber: Aklapper. Β· View Herald Transcript

Is this because CodeMirror isn't listening to the form's reset event? That might be one fix, but yeah as you say the other is to go back to explicitly setting the form field values (with, in the case of the main textarea, the textSelection API). The change to using reset (for T351821) isn't strickly necessary.

Change 987029 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/core@master] Edit Recovery: switch back from form.reset() to manual setting

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

Change 987029 merged by jenkins-bot:

[mediawiki/core@master] Edit Recovery: switch back from form.reset() to manual setting

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

@Samwilson When clicking on Discard changes, the changes are discarded and the notification box disappears. When I do Show changes though, the notification box does not go away as seen in the .webm files below.

Status: ❌ FAIL
Environment: Beta: 1.42.0-alpha (91b4604)
OS: macOS Sonoma 14.2.1
Browser: Chrome 120, Firefox 120, Safari 17.2, Edge 120
Skins. Vector 2022, 2010, Minerva, Monobook, Timeless
Device: MBA M2
Emulated Device:: n/a
Test Links:
https://en.wikipedia.beta.wmflabs.org/w/index.php?title=Module:Basketball_color&action=edit
https://en.wikipedia.beta.wmflabs.org/w/index.php?title=Dog&action=edit

❌AC1: https://phabricator.wikimedia.org/T353616- Show Changes

Edit RecoveryCodemirrorCodeEditor
Show changes

βœ…AC2: https://phabricator.wikimedia.org/T353616- Discard Changes

Edit RecoveryCodemirrorCodeEditor
Discard changes

The changes are discarded. That is, clicking "Show changes" shows "(No difference)".

By this I meant "Show changes" below the editing box, not the one in the popup (which should disappear after clicking "Discard changes", which is the last in the steps to reproduce).

The changes are discarded. That is, clicking "Show changes" shows "(No difference)".

By this I meant "Show changes" below the editing box, not the one in the popup (which should disappear after clicking "Discard changes", which is the last in the steps to reproduce).

Got it, thanks for the clarification! Changes are discarded and when clicking on Show Changes it displays "No Difference". I will move this to Done. Thanks for all your work!

AC1: https://phabricator.wikimedia.org/T353616- Show Changes

As for this one, there will be some discussion to be had around when the notification toast should disappear, so at the moment it stays around if you click 'show changes'. But that might change after more user feedback.

Status: βœ… PASS
Environment: Beta: 1.42.0-alpha (c6251dc)
OS: macOS Sonoma 14.2.1
Browser: Chrome 120, Firefox 120, Safari 17.2, Edge 120
Skins. Vector 2022, 2010, Minerva, Monobook, Timeless
Device: MBA M2
Emulated Device:: n/a
Test Links:
https://en.wikipedia.beta.wmflabs.org/w/index.php?title=Module:Basketball_color&action=edit
https://en.wikipedia.beta.wmflabs.org/w/index.php?title=Dog&action=edit

βœ…AC1: https://phabricator.wikimedia.org/T353616

CodeMirrorCodeEdit