Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content loss when switching between code and visual editor with the keyboard shortcut (Ctrl+Shift+Alt+M) #40575

Closed
sabernhardt opened this issue Apr 25, 2022 · 4 comments · Fixed by #40730
Assignees
Labels
[Feature] Code Editor Handling the code view of the editing experience Needs Dev Ready for, and needs developer efforts [Priority] Highest (OMGBBQ) Used to indicate widespread, critical issues that need immediate attention [Type] Bug An existing feature does not function as intended

Comments

@sabernhardt
Copy link
Contributor

Description

As @angelxube reported on Trac 49795:

When using keyboard shortcut Ctrl+Shift+Alt+M to switch from code editor back to visual editor all text will be lost. Pressing top right link or switching throught options menu works without problem. I consider this as a bug, because user will lost any change he put to code editor unless he previously save his work or click on link "Back to the visual editor"

Step-by-step reproduction instructions

  1. Create a new post or page.
  2. Switch to Code view (on PC, Ctrl + Shift + Alt + M).
  3. Start typing in the post content area.
  4. Use the keyboard shortcut again to exit Code view.
  5. Notice that what you typed is gone.

Screenshots, screen recording, code snippet

@afercia's graphic from the Trac ticket:

animated graphic of content loss when exiting Code view

Environment info

Trac 49795 reported it as early as WordPress 5.4.

WordPress versions I used:

  • 5.9 without Gutenberg
  • 5.9 with Gutenberg 13.0.0
  • 6.0 beta 2, without Gutenberg

Browser/OS:
Firefox 99.0.1/Windows 10

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@sabernhardt
Copy link
Contributor Author

@Otto42's comment:

It appears that clicking anywhere outside of the content block makes it "stick" when you switch. It only loses content when you switch with the keyboard without ever leaving the text block.

Seemingly anything that causes that text box in the code editor to lose focus will save it, and then it will be there after the switch.

@Mamaduka Mamaduka added [Type] Bug An existing feature does not function as intended [Feature] Code Editor Handling the code view of the editing experience labels Apr 26, 2022
@gziolo gziolo added [Priority] Highest (OMGBBQ) Used to indicate widespread, critical issues that need immediate attention Needs Testing Needs further testing to be confirmed. labels Apr 27, 2022
@ndiego
Copy link
Member

ndiego commented Apr 29, 2022

I have confirmed this. While we need to fix this bug, at this point in the release process, I think we should hold off trying to include in 6.0. We could always include in a minor release. Thoughts @Mamaduka @gziolo?

@gziolo
Copy link
Member

gziolo commented Apr 29, 2022

Content loss is always a critical issue that should have maximum priortity.

@gziolo gziolo added Needs Dev Ready for, and needs developer efforts and removed Needs Testing Needs further testing to be confirmed. labels Apr 29, 2022
@Mamaduka
Copy link
Member

I will try to have a look at this issue in a bit 👍

@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Apr 29, 2022
@ndiego ndiego moved this from Triage to In Progress in WordPress 6.0 Editor Tasks Apr 29, 2022
Repository owner moved this from In Progress to Done in WordPress 6.0 Editor Tasks May 3, 2022
@priethor priethor removed the [Status] In Progress Tracking issues with work in progress label May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Code Editor Handling the code view of the editing experience Needs Dev Ready for, and needs developer efforts [Priority] Highest (OMGBBQ) Used to indicate widespread, critical issues that need immediate attention [Type] Bug An existing feature does not function as intended
Projects
No open projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants