[wp-trac] [WordPress Trac] #41900: Code Editor: Cursor jumps to end of file upon focus in the "contenteditable" inputStyle for CodeMirror in Additional CSS

WordPress Trac noreply at wordpress.org
Sat Sep 23 16:37:43 UTC 2017


#41900: Code Editor: Cursor jumps to end of file upon focus in the
"contenteditable" inputStyle for CodeMirror in Additional CSS
--------------------------+----------------------------
 Reporter:  westonruter   |       Owner:  westonruter
     Type:  defect (bug)  |      Status:  accepted
 Priority:  high          |   Milestone:  4.9
Component:  Customize     |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:  accessibility
--------------------------+----------------------------
Changes (by westonruter):

 * keywords:   => needs-patch
 * owner:   => westonruter
 * status:  new => accepted


Comment:

 I believe the cause has been identified by @afercia in
 [https://core.trac.wordpress.org/ticket/41872#comment:19 #41872]:

 > > When clicking on the label it should focus on the CodeMirror editor.
 >
 > Trying this on the Additional CSS, focus always goes to the last line
 (and if the content is very long, it's out of view). Seems to me because
 of:
 > {{{
 >                       // Refresh when receiving focus.
 >                       control.editor.codemirror.on( 'focus', function(
 codemirror ) {
 >                               codemirror.refresh();
 >                       });
 > }}}
 >
 >
 > Is this really necessary? And why it is used only for the Additional CSS
 and not for the other CodeMirror instances? If there are no particular
 reasons, I'd consider to remove it.

 I do think actually that `codemirror.refresh()` is obsolete because we are
 already ensuring the textarea is synced.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/41900#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list