WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#37243 closed defect (bug) (fixed)

TinyMCE always gets focus on load

Reported by: afercia Owned by: azaozz
Milestone: 4.6 Priority: normal
Severity: normal Version: 4.6
Component: Editor Keywords: needs-patch
Focuses: javascript Cc:
PR Number:

Description

I can reproduce this only on webkit browsers (Chrome and Safari on OS X and Chrome on Windows), no idea why Firefox is not affected. Haven't tested IE.

Looks like on any page where TinyMCE is used (Edit Post, Page, CPTs, etc.) TinyMCE gets the focus when initialised and the cursor is placed inside the editor area. On Chrome, when a post has a very long content, this causes also the page to scroll.

Reverting [37906] fixes it for me. As far as I see, this line
https://core.trac.wordpress.org/browser/trunk/src/wp-includes/js/tinymce/plugins/wplink/plugin.js?rev=37906#L573
always runs the wp_link_cancel command when TinyMCE initialises. Really not a TinyMCE expert here :) but quickly looking at the TinyMCE source I see that execCommand() always tries to focus the editor except for a few cases.

Change History (2)

#1 @azaozz
4 years ago

Confirmed. Fix coming up.

#2 @azaozz
4 years ago

  • Owner set to azaozz
  • Resolution set to fixed
  • Status changed from new to closed

In 37927:

TinyMCE: do not trigger execCommand on loading, it focuses the editor in Chrome.

Fixes #37243.

Note: See TracTickets for help on using tickets.