BUG: Firefox trims trailing white space, unexpected cursor behavior
See original GitHub issueDo you want to request a feature or report a bug?
report a bug
What’s the current behavior?
If a text node ends in a \n
when a user presses enter
, Firefox trims the whitespace and the cursor stays on the same line. If the user continues typing, the characters appear in the correct location. If the user presses down arrow, the cursor will appear on the correct line.
If I change the event handler from Transforms.insertText(editor,
\n)
to Transforms.insertText(editor,
\n\u2060)
(adds a zero width white space) the editor works as expected.
See sandbox: here
Slate: 0.59.0 Browser: Firefox OS: Mac
What’s the expected behavior?
It should move the cursor to the new line as it does on Chrome.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:8
- Comments:6
Top Results From Across the Web
When a space overflows the width of a div, the previous word ...
The problem with your patch, afaict, is that it trims all of the trailing white space... which looks fine, but can be a...
Read more >Firefox wrongly trims trailing white space when editing
The result seems OK: when you see the cursor blinking after that, it appears that there is a trailing space after "Lorem".
Read more >117968 – White space added when enter pressed
three times. The real problem is that the editor inserts useless trailing whitespace as you edit. This has long been complained about.
Read more >The poor, misunderstood innerText - Perfection Kills
innerText = $(this)[0].title; // fails in Mozilla ... Notice that no whitespace normalization is performed, the text and whitespace are ...
Read more >JupyterLab Changelog — JupyterLab 3.6.0b0 documentation
Add show trailing whitespace option to Notebook and Text Editor #11131 (@blink1073) ... Fix cell type dropdown behaviour in Firefox on 3.1.x branch...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Are there more solutions for this bug?
This ckeditor PR might be related:
https://github.com/ckeditor/ckeditor5-engine/pull/1582/files
This code in particular: