Skip to content

On Firefox for Android with the Samsung Keyboard, Slate fails to insert some characters #6051

Description

@nsoriano-druide

Description
On Firefox for Android, using the Samsung Keyboard, entering characters fails and is accompanied by an error in the console. Notably, it seems to always happen with the second character on a new line.

Recording
Here is a recording of the anomalous behaviour.

bug_android_firefox_samsung_slate.mp4

And here is a screenshot of the error.
Image

Sandbox
It can be reproduced using the Rich Text Example (https://www.slatejs.org/examples/richtext) on an android device using Firefox for Android and the Samsung Keyboard.

Steps
To reproduce the behavior:

  1. Go to the slate examples
  2. Add a new line
  3. Insert a character (ex: "Y")
  4. Insert a second one (ex: "o")
  5. The second character does not appear and, if you have access to its web console (e.g. through the Firefox debugger), an error appears in the console ("Uncaught TypeError: can't access property "hasAttribute", s is null")

Expectation
No error

and the character is correctly inserted.

Environment

  • Slate Version: 0.124.1 (current version as of testing) -> but also present on 0.118.1, 0.121, 0.123 (I did not test on 0.120)
  • Operating System: Android
  • Browser: Firefox for Android
  • Keyboard: Samsung Keyboard

Context
The error seems to be in the android handleDOMBeforeInput. The beforeinput event's startContainer and endContainer have parentNode that are null which leads to an error in the toSlateRange -> toSlatePoint call in the handleDOMBeforeInput.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions