#952·draft-js

Editor won't auto-scroll to keep cursor in view when cursor is inside a Decorator Component

Author: elloyd-spredfastCreated Jan 17, 2017Updated Oct 27, 2022

Right now, if you are typing in a normal draft-js editor, without any decorators, and your editor is set up to scroll instead of auto-expand, as you type past the end of the visible space in the editor, the cursor will automatically scroll up so the text you are typing is visible.

However, if you are typing and your cursor is inside a Decorator Component, the editor will not auto-scroll to show the cursor.

It's expected that the editor will always scroll to show the cursor when typing, regardless of whether the cursor is inside a decorator component or not.

Here is a fiddle to show the problem: https://jsfiddle.net/axrbyfpp/3/. If you type enough text to cause the box to scroll, the cursor disappears and doesn't cause the editor to auto-scroll. However, if you either remove the decorator, or just change it by commenting out and in the lines specified in the fiddle, then the editor will auto-scroll as expected.

I don't believe this ever worked in Draft, but it's not working using v.0.9.1. Tested using Chrome, Safari and Firefox on Mac OS X 10.11.6

Source: facebookarchive/draft-js