Page MenuHomePhabricator

Copying and pasting large pages causes misalignment between CodeMirror and VE surfaces
Closed, ResolvedPublicBUG REPORT

Assigned To
Authored By
MusikAnimal
Aug 30 2024, 12:12 AM
Referenced Files
F57689625: T373649_2.webm
Nov 8 2024, 6:20 PM
F57689591: T373649.webm
Nov 8 2024, 6:20 PM
F57681151: 2024-11-04_16-48-47.png
Nov 5 2024, 1:20 AM
F57681150: 2024-11-04_16-49-26.png
Nov 5 2024, 1:20 AM
F57681148: 2024-11-04_16-41-30.png
Nov 5 2024, 1:20 AM
F57681146: 2024-11-04_16-40-55.png
Nov 5 2024, 1:20 AM
F57681052: 2024-11-04_16-18-34.png
Nov 5 2024, 12:24 AM
F57681051: 2024-11-04_16-19-45.png
Nov 5 2024, 12:24 AM

Description

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

What happens?:

  • Scroll down and observe the content is outside the editing area (because CodeMirror and VE surfaces are misaligned)
  • You can also run $(".ve-ce-documentNode-codeEditor-webkit-hide").css('-webkit-text-fill-color', 'black'); in your JS console to more clearly see the misalignment

What should have happened instead?:

There should be no misalignment.

Other information

I think this is because the change in gutter width isn't being accounted for. This should be fixable.

Note this only effects CodeMirror 6, which as of the time of writing is only rolled out on mediawiki.org and the Beta cluster.

Derived Requirement

Ensure there is no misalignment between the CodeMirror and VisualEditor (VE) surfaces when performing content cut and paste actions in CodeMirror 6 on MediaWiki pages.

BDD

Feature: Consistent Alignment Between CodeMirror and VisualEditor Surfaces

Scenario: Ensure no misalignment between CodeMirror and VE surfaces after content cut and paste

Given the user has CodeMirror 6 enabled on a MediaWiki page using the VisualEditor
When the user selects all content, cuts it, and pastes it back
Then the CodeMirror and VE surfaces should remain aligned without content being rendered outside the editing area
Test Steps

Test Case 1: Ensure No Misalignment Between CodeMirror and VE Surfaces After Cut and Paste

Navigate to this page with CodeMirror 6 enabled.
Press Ctrl + A (Windows) or Cmd + A (macOS) to select all content.
Press Ctrl + X (Windows) or Cmd + X (macOS) to cut the selected content.
Press Ctrl + V (Windows) or Cmd + V (macOS) to paste the content back into the editor.
Scroll down and observe the alignment of the content within the editing area.
✅❓❌⬜ AC1: Confirm that the content remains within the editing area, and there is no misalignment between the CodeMirror and VE surfaces.
Optionally, run the following in the JS console to make the misalignment more visible:
$(".ve-ce-documentNode-codeEditor-webkit-hide").css('-webkit-text-fill-color', 'black');.

QA Results - Beta

ACStatusDetails
1✅T373649#10304996

Event Timeline

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

Change #1070330 had a related patch set uploaded (by MusikAnimal; author: MusikAnimal):

[mediawiki/extensions/CodeMirror@master] ve.ui.CodeMirror.v6: update gutter width after CM view is updated

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

Change #1070330 merged by jenkins-bot:

[mediawiki/extensions/CodeMirror@master] ve.ui.CodeMirror.v6: update gutter width after CM view is updated

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

@MusikAnimal Let me know if the videos below are fine. I do have an unrelated issue that I also wanted you to check out regarding a weird alignment issue in dark mode for source editing but light mode was fine?

Test Result - Beta

Status: ❓ NMI
Environment: Beta
OS: macOS Sonoma 14.6.1
Browser: Chrome 128
Device: MBA
Emulated Device: NA

Test Artifact(s):

Test Steps

Test Case 1: Ensure No Misalignment Between CodeMirror and VE Surfaces After Cut and Paste

Navigate to this page with CodeMirror 6 enabled.
Press Ctrl + A (Windows) or Cmd + A (macOS) to select all content.
Press Ctrl + X (Windows) or Cmd + X (macOS) to cut the selected content.
Press Ctrl + V (Windows) or Cmd + V (macOS) to paste the content back into the editor.
Scroll down and observe the alignment of the content within the editing area.
❓AC1: Confirm that the content remains within the editing area, and there is no misalignment between the CodeMirror and VE surfaces.

Is this fine? I am getting an error in the console but also not related to the task

Unrelated to the task but during source editing when repeating those same steps, alignment gets a little crazy as seen in the video but only in Dark mode.

DarkLight

Let me know if the videos below are fine. I do have an unrelated issue that I also wanted you to check out regarding a weird alignment issue in dark mode for source editing but light mode was fine?

First of all, my apologies for the long delay in getting back to this! As you know other priorities got in the way.

❓AC1: Confirm that the content remains within the editing area, and there is no misalignment between the CodeMirror and VE surfaces.

Is this fine? I am getting an error in the console but also not related to the task

This is the visual mode. When we are talking about CodeMirror, we are only referring to source editing. Try https://en.wikipedia.beta.wmflabs.org/wiki/Fox?veaction=editsource instead.

Unrelated to the task but during source editing when repeating those same steps, alignment gets a little crazy as seen in the video but only in Dark mode.

DarkLight
F57470262F57470357

F57470262 is actually the issue we are trying to fix! I'm not seeing the issue on my end, however. It's been like 1.5 months so something else may have changed that fixed it? I'm not sure, but do please re-verify that you're not seeing this behaviour anymore on your end.

F57470357 shows the 2010 editor, not VE. For this task we're only concerned about VE source editing.

@MusikAnimal Pasting has no error, but look at the webm when I go to source editing. Check out some of the overlapping words just from the load, especially at the bottom. Let me know what you think.

Let me know if the videos below are fine. I do have an unrelated issue that I also wanted you to check out regarding a weird alignment issue in dark mode for source editing but light mode was fine?

First of all, my apologies for the long delay in getting back to this! As you know other priorities got in the way.

❓AC1: Confirm that the content remains within the editing area, and there is no misalignment between the CodeMirror and VE surfaces.

Is this fine? I am getting an error in the console but also not related to the task

This is the visual mode. When we are talking about CodeMirror, we are only referring to source editing. Try https://en.wikipedia.beta.wmflabs.org/wiki/Fox?veaction=editsource instead.

Unrelated to the task but during source editing when repeating those same steps, alignment gets a little crazy as seen in the video but only in Dark mode.

DarkLight
F57470262F57470357

F57470262 is actually the issue we are trying to fix! I'm not seeing the issue on my end, however. It's been like 1.5 months so something else may have changed that fixed it? I'm not sure, but do please re-verify that you're not seeing this behaviour anymore on your end.
F57470357 shows the 2010 editor, not VE. For this task we're only concerned about VE source editing.

Test Result - Beta

Status: ❓Needs more info
Environment: Beta
OS: macOS Sonoma 15.0
Browser: Chrome 130/ Firefox 132
Device: MBA
Emulated Device: NA

Test Artifact(s):
https://en.wikipedia.beta.wmflabs.org/w/index.php?title=Fox&veaction=editsource

On my MacBook Air

Chrome w/CSSChrome w/o CSSFirefox w/CSSFirefox w/CSS
2024-11-04_16-14-23.png (1,028×873 px, 376 KB)
2024-11-04_16-15-13.png (1,027×957 px, 245 KB)
2024-11-04_16-19-45.png (1,123×980 px, 274 KB)
2024-11-04_16-18-34.png (1,132×974 px, 222 KB)

BrowserStack- The weird thing is that I didn't come across it in BrowserStack on either OS of Sequoia and Sonoma, Chrome Version 130.0.6723.92

Sequoia

Chrome w/CSSChrome w/o CSS
2024-11-04_16-40-55.png (2,138×1,091 px, 1 MB)
2024-11-04_16-41-30.png (1,793×1,032 px, 1016 KB)

Sonoma

Chrome w/CSSChrome w/o CSS
2024-11-04_16-49-26.png (1,787×1,105 px, 1 MB)
2024-11-04_16-48-47.png (1,796×1,163 px, 1 MB)

I recently submitted r1087618 which may have helped the issue mentioned at T373649#10291083. @GMikesell-WMF could I get you to test that once more?

Regardless, assuming there's no issue with copying and pasting, then I guess this can be moved to Done.

@MusikAnimal On my laptop it's still overlapping on the load but not as bad as the previous one and actually cleaned it up more after the paste, as seen in the webm. On Browserstack, I did not come across that issue at all with the same OS and Browser version. Regardless like you said there were no issues with copying and pasting so I will move this to Done. Thanks for all your work!

Test Result - Beta

Status: ✅ PASS
Environment: Beta
OS: macOS Sonoma 15.0.1
Browser: Chrome 130
Device: MBA & BrowserStack
Emulated Device: NA

Test Artifact(s):

Test Steps

Test Case 1: Ensure No Misalignment Between CodeMirror and VE Surfaces After Cut and Paste

  1. Navigate to this page with CodeMirror 6 enabled.
  2. Press Ctrl + A (Windows) or Cmd + A (macOS) to select all content.
  3. Press Ctrl + X (Windows) or Cmd + X (macOS) to cut the selected content.
  4. Press Ctrl + V (Windows) or Cmd + V (macOS) to paste the content back into the editor.
  5. Scroll down and observe the alignment of the content within the editing area.
  6. ✅AC1: Confirm that the content remains within the editing area, and there is no misalignment between the CodeMirror and VE surfaces.
LaptopBrowserStack
GMikesell-WMF updated Other Assignee, removed: GMikesell-WMF.
GMikesell-WMF moved this task from QA to Done on the Community-Tech (Jackal (not a fox) Fox) board.