Make WordPress Core

Opened 6 years ago

Last modified 16 months ago

#44820 new defect (bug)

CodeMirror in Customize - copy & paste bug

Reported by: dionysous's profile dionysous Owned by:
Milestone: Future Release Priority: normal
Severity: minor Version: 4.9
Component: Customize Keywords: has-patch needs-testing
Focuses: ui, javascript, administration Cc:


Wrong behavior in CodeMirror:
I go to Customize > Additional CSS and copy one selector including the opening curly bracket "{". I paste the copied text at the end of the content of the CSS textarea and press enter to create a new line. The new line won't be created, instead Autocompletion of CodeMirror is executed and the CSS attribute align-content is added.

Animated screen capture as GIF:

It only happens, when the selector is pasted at the end (of the textarea) and if the CSS field was already filled out and the Customize have been saved before.

Attachments (2)

44820.diff (633 bytes) - added by pento 5 years ago.
44820.2.diff (1.3 KB) - added by pento 5 years ago.

Download all attachments as: .zip

Change History (7)

#1 @dlh
6 years ago

  • Version changed from 4.9.8 to 4.9

#2 @SergeyBiryukov
6 years ago

  • Keywords reporter-feedback added

Hi @dionysous, welcome to WordPress Trac! Thanks for the report.

I could not reproduce the issue on a clean install with Opera 55 (Windows 10).

  1. Does it happen in CodeMirror demos on
  2. Which browser are you using?

#3 @dionysous
6 years ago

Hello @SergeyBiryukov ,

thank you for trying. Try copying this CSS code:

.class .class-2 #id-here {


...and save the Customize options then. Reload the Customize.
Paste only this after the saved CSS code:

.class .class-2 #id-here {

The cursor/focus should be after the openin {. Next press enter key. Then the align-content suggestion should appear.

It happened for users on Windows, e.g. on Chrome or Firefox.

I could reproduce it now in Safari (latest) and Google Chrome (latest) on MacOS, but we have users/webdesigners, which reported us the problem on Windows systems.

Can you reproduce the bug now?

5 years ago

5 years ago

#4 @pento
5 years ago

  • Keywords has-patch needs-testing added; reporter-feedback removed
  • Milestone changed from Awaiting Review to Future Release

Thank you for the additional information, @dionysous!

I'm able to reproduce this bug consistently. In order to reproduce it, you need to to paste with Cmd+V, and release the Cmd key before releasing V.

In code-editor.js, in the wp.codeEditor.initialize function, the keyup event is deciding to show the autocomplete dropdown because isAlphaKey is true.

44820.2.diff fixes this issue, but I suspect that JS and HTML editing will have similar issues, too.

#5 @zackpyle
16 months ago

How is this still not fixed 4 years later?

Note: See TracTickets for help on using tickets.