slate icon indicating copy to clipboard operation
slate copied to clipboard

Placeholder text slow to re-appear after content has been cleared

Open endercrest opened this issue 1 year ago • 6 comments

Description Previously, clearing text would have the placeholder text appear again instantly. However, in 0.94.0 (and possibly 0.93.0) that placeholder takes some time to re-appear.

The placeholder works as expected in 0.92.0.

Recording A GIF or video showing the issue happening. (If you don't include this, there's a very good chance your issue will be closed, because it's much too hard to figure out exactly what is going wrong, and it makes maintenance much harder.)

https://github.com/ianstormtaylor/slate/assets/2616075/61e834ab-67ca-433f-b4b8-35cdbf857e19

Sandbox https://codesandbox.io/s/slate-reproductions-forked-bufv30?file=/index.js

Steps

  1. Create slate editor with placeholder
  2. type text in
  3. remove text

This can also be replicated on the official examples: https://www.slatejs.org/examples/richtext

Expectation I would have expected that the placeholder text to re-appear immediately after the text is cleared.

Video on slate-react on 0.92.0

https://github.com/ianstormtaylor/slate/assets/2616075/102d8ee5-b209-4ac1-9d9b-960d00244843

Environment

  • Slate Version: 0.94.0
  • Operating System: macOS
  • Browser: Chrome

Context Just updated to the latest version from 0.88.1 and noticed this immediately.

endercrest avatar May 11 '23 22:05 endercrest

I'm seeing this as well. Tracked it down to slate-react 0.93.0. Most likely from https://github.com/ianstormtaylor/slate/commit/5a0d3974d6cb2c099dff4c0976e9390d24c345ad

Also causes some additional issues with my specific Slate editor inside a webview on native where the delayed placeholder after deletion causes the cursor to disappear then subsequent deletes break the editor. This was not the case before slate-react 0.93.0 when the placeholder rendered immediately.

slate-react 0.92.0

https://github.com/ianstormtaylor/slate/assets/28637598/7ca971be-302e-403c-8a6a-d6cca5ad9de1

slate-react 0.93.0

https://github.com/ianstormtaylor/slate/assets/28637598/48bbbeb2-86e1-423f-bfdc-a94f7345512d

josephmr avatar May 18 '23 22:05 josephmr

I'm seeing this as well. Tracked it down to slate-react 0.93.0. Most likely from https://github.com/ianstormtaylor/slate/commit/5a0d3974d6cb2c099dff4c0976e9390d24c345ad

Yeah, it's explicitly waiting 300 ms to show, which seems like an exceptionally long time for the purpose of allowing selections to settle. I wonder what the case is where that would take more than a couple milliseconds?

wfischer42 avatar Jun 05 '23 15:06 wfischer42

@edhager do you have any thoughts on this one? About the placeholder delay

edify-jashmore avatar Jun 29 '23 16:06 edify-jashmore

I agree with the others, 300ms is way too long. It's visually distracting and It looks like a bug. Is it possible to remove this delay?

Arkellys avatar Jul 16 '23 10:07 Arkellys

+1 this is impacting our app

davisg123 avatar Aug 01 '23 18:08 davisg123

Fixed for non-android devices with this PR available on [email protected]

Arkellys avatar Dec 25 '23 13:12 Arkellys