[wp-trac] [WordPress Trac] #42530: Unexpected focus lost when switching editor tabs

WordPress Trac noreply at wordpress.org
Tue Nov 14 04:41:07 UTC 2017


#42530: Unexpected focus lost when switching editor tabs
------------------------------+--------------------------------------------
 Reporter:  ocean90           |       Owner:  pento
     Type:  defect (bug)      |      Status:  assigned
 Priority:  normal            |   Milestone:  4.9
Component:  Editor            |     Version:  4.9
 Severity:  normal            |  Resolution:
 Keywords:  has-patch needs-  |     Focuses:  accessibility, administration
  testing                     |
------------------------------+--------------------------------------------
Changes (by pento):

 * keywords:  2nd-opinion needs-patch => has-patch needs-testing


Comment:

 The existing behaviour prior to 4.9 is:

 - When switching to the Text view, the `<textarea>` is not focussed.
 - When switching to the Visual view, the editor is focussed, with the
 cursor placed at the start of the content.

 The new behaviour in trunk is for switching to either to focus the
 relevant editor box, at the point that was previously selected. This
 behaviour can be disabled by changing the `wp_keep_scroll_position`
 TinyMCE setting to `false`, the `tiny_mce_before_init` filter is the best
 option for doing that globally.

 So, [attachment:42530.diff] is mostly a tweak to the scrolling behaviour:

 - When switching to the Text view, wait until after the Visual editor
 element has been hidden before focussing the `<textarea>`.
 - When switching to the Visual view, only scroll if the selection is not
 on the current screen.

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


More information about the wp-trac mailing list