draft-js icon indicating copy to clipboard operation
draft-js copied to clipboard

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

Open elloyd-spredfast opened this issue 8 years ago • 7 comments

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

elloyd-spredfast avatar Jan 17 '17 22:01 elloyd-spredfast

Just tried out this fiddle as I'm researching what appears to be the same issue of the cursor not scrolling and text entry goes off the bottom of the container.

That said your jsfiddle works perfectly with the text staying perfectly in scroll.

samkelleher avatar Mar 10 '17 11:03 samkelleher

Just tried my fiddle again. Using Mac OS X 10.11.6 and Chrome 56.0.2924.87 (64-bit), the problem still occurs (In the following gif I'm typing the entire time): fiddle_not_working

elloyd-spredfast avatar Mar 13 '17 15:03 elloyd-spredfast

This is definitely still a problem in 0.10.4.

If I decorate my text, it won't auto-scroll. If I comment out the decorator, works fine.

zhubert avatar Nov 25 '17 06:11 zhubert

I notice this issue is still open. Is there any recommended workaround or a plan for improvement?

Not only decorator but adding new line with shift+enter in a scrollable editor with max height will also hide the cursor (until typing some char which is not decorator trigger).

wushaobo avatar May 08 '20 08:05 wushaobo

This problem still occurs. Is there any recommended solution or plan to solve this. Please share. TIA

rrijvy avatar Jul 13 '21 09:07 rrijvy

This problem still occurs.

Tungetyt avatar May 25 '22 08:05 Tungetyt

Still an issue

wickandpiper avatar Oct 27 '22 13:10 wickandpiper