Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#29954 closed defect (bug) (fixed)

Improve calculation of the caret position in editor-expand

Reported by: azaozz Owned by: azaozz
Milestone: 4.1 Priority: normal
Severity: normal Version: 4.0
Component: Editor Keywords: has-patch needs-testing
Focuses: Cc:


Currently we use node.getBoundingClientRect() to get the approximate position of the caret in TinyMCE. This works well except it gets the position of the parent block. We should use range.getClientRects() when available to get the exact position of the caret.

This will fix scrolling into view when the current block element is taller than the visible part of the editor.

Attachments (2)

29954.patch (2.8 KB) - added by azaozz 7 years ago.
29954.2.patch (2.4 KB) - added by iseulde 7 years ago.

Download all attachments as: .zip

Change History (6)

7 years ago

#1 @azaozz
7 years ago

In 29954.patch:

  • Use range.getClientRects() when available.
  • Keep the caret visible after undo/redo.

#2 @azaozz
7 years ago

  • Keywords has-patch needs-testing added

7 years ago

#3 @iseulde
7 years ago

Fixed the buffer. Looks good to me otherwise. :)

#4 @azaozz
7 years ago

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

In 29929:


  • Better calculation for the caret position when auto-scrolling while typing.
  • Fix auto-scrolling for non-WebKit browsers when the caret is above the top of the editor.

Fixes #29954

Note: See TracTickets for help on using tickets.