ianstormtaylor / slate

A completely customizable framework for building rich text editors. (Currently in beta.)
http://slatejs.org
MIT License
29.29k stars 3.21k forks source link

Touch screen android TV and firefox gives multiple times occurring letters #5666

Open dpranav007 opened 1 week ago

dpranav007 commented 1 week ago

Description Touch screen TV(android) + firefox browser creates extra instances of the characters being typed. Typing quickly in some cases makes the characters repeat in sequence. Only occurs for on-screen keyboard. Not any physically attached one.

Eg. Typing 'ABC'(quickly) results in -> 'ABCABCABABA' being show up Typing just 1 character - 'A' gets an extra character 'AA'

Recording From slatejs website - https://www.slatejs.org/examples/richtext

https://github.com/ianstormtaylor/slate/assets/13598727/303b7b17-ff5f-4af3-b3cc-6bc35ab6a1bc

Sandbox https://www.slatejs.org/examples/richtext

Steps To reproduce the behavior:

  1. Use touch screen based TV(BENQ 55inch screen used here)
  2. Firebox browser(default on this screen)
  3. Open slatejs website and start typing using the onscreen keyboard

Expectation A clear and concise description of what you expected to happen. (Often it's helpful to test out the behavior of other editors like Google Docs, Medium, Notion, etc. to see how they handle the same issue.)

Environment

dylans commented 1 week ago

@dpranav007 is this just with A-Z, a-z and 0-9 or any keys?

If it's just those keys specifically, it's probably an issue with onbeforeinput events and there's a single regex that you can change to not use native onbeforeinput events.

dpranav007 commented 1 week ago

@dylans Yes, the extra character behavior is only for A-Z, a-z. No extra inputs are visible when input is 0-9 or any special chars ($%^&*, etc)

The behavior is only happening at first input of the input box(when input box is empty) and not further in any sentence.

Also another issue that happens starting a new line/para(after 'enter' key press) the cursor moves 1 character back and letters show up in reverse order. This is applicable to special chars ($%^&*, etc) as well where the cursor moves backward Sharing a video here. Thanks a lot. Appreciate it!

https://github.com/ianstormtaylor/slate/assets/13598727/50865333-29dd-4c0e-94e2-450035a8c98b