Ckeditor4: Focus the editor and place the cursor at the end of the text

Created on 3 Sep 2019  路  3Comments  路  Source: ckeditor/ckeditor4

Type of report

Bug

Provide detailed reproduction steps (if any)

  1. Open the editor
  2. Lose focus by clicking outside the editor
  3. on the console, execute the command
CKEDITOR.instances[instance_name].focus()

Expected result

  • The cursor/Caret should be active on the CKEDITOR

Actual result

  • Cursor/ Caret is not displayed

Other details

  • Browser: Chrome
  • OS: OSX
  • CKEditor version: 4.2.1
  • Installed CKEditor plugins: none
upstream bug

All 3 comments

Does the issue occur without the open console? Console seems to steal focus, but without it everything works correctly. I could place the cursor inside the editor with following steps:

  1. Place cursor inside editor.
  2. Click outside the editor.
  3. Open console and execute:
    javascript setTimeout( CKEDITOR.instances[ instanceName ].focus.bind( CKEDITOR.instances.editor ), 5000 );
  4. Before the timeout, click anywhere on page (to move focus outside the console).
  5. Wait for the timeout.

In such scenario focus is moved correctly into the editor.

Yes, this way the cursor focuses on the Editor.
setTimeout( CKEDITOR.instances["instance_name"].focus.bind( CKEDITOR.instances. instance_name),5000);

Is there a way to do it without setTimeout ?

Unfortunately no. We can't steer the focus in any sensible way, when console is opened and focused.

I'm closing this issue as it can't be fixed on our side and it's clearly connected with the behaviour of browser's console.

Was this page helpful?
0 / 5 - 0 ratings