Safari 9.1.x Not Performing ENTER Correctly
Description
SHIFT- ENTER doesn't work as expected after pressing ENTER when in Safari.
Steps to reproduce
- Open in Safari.
- Type text in editable field.
- Hit SHIFT-ENTER in your text. (Do not hit ENTER just yet.)
- Observe that SHIFT-ENTER is working as expected.
- Hit ENTER.
- Observe that the cursor does not advance correctly.
- Continue typing.
- Hit SHIFT-ENTER and observe broken behavior.
Expected behavior: SHIFT-ENTER adds a soft-return, moving the cursor to the next line. ENTER starts a new paragraph, moving the cursor to the start of the new paragraph.
Actual behavior:
I am experiencing this as well in Safari 9.1.1 and 9.1.2. The behavior of SHIFT-ENTER vs ENTER is flawed (works fine in Chrome). If you start off pressing SHIFT-ENTER everything will be fine until you hit ENTER. That will add
<br>
<p><br></p>
<br>
directly after the spot you hit enter, and it won't push the cursor to the end, but just before the opening <p> tag. If you start typing or hit SHIFT-ENTER everything is hopelessly messed up.
However, if you don't type, but move the cursor to then end, SHIFT-ENTER will continue behaving as normal -- until you hit ENTER again. Rinse and repeat.
Hopefully this helps somewhat in troubleshooting the issue and maybe coming up with a script that attempts to fix Safari's ill behavior. :)
I think the code that is inserted is correct, but the problem appears that the cursor is not being advanced correctly.
Versions
- medium-editor: 5.20.0
- browser: Safari 9.1.1 and 9.1.2
- OS: Max OS X.11.5
Can confirm, that Shift+Enter on Safari 9.1.2 @ OSX 10.11.6 Beta produces <p> not <br>.
@mikebronner @kroko can either of you confirm whether this happens with a plain <div contenteditable="true"> element without initializing medium-editor? If you could confirm that it could help us determine whether this is a bug introduced by medium-editor, or an issue with safari that medium-editor could attempt to help fix...
Thanks a ton for opening the issue and giving such fantastic details on the issue.
Is there any news on the soft-return bug with Safari?
Thanks
We're also experiencing this broken behaviour with Safari =/