medium-editor icon indicating copy to clipboard operation
medium-editor copied to clipboard

Safari 9.1.x Not Performing ENTER Correctly

Open mikebronner opened this issue 9 years ago • 4 comments

Description

SHIFT- ENTER doesn't work as expected after pressing ENTER when in Safari.

Steps to reproduce

  1. Open in Safari.
  2. Type text in editable field.
  3. Hit SHIFT-ENTER in your text. (Do not hit ENTER just yet.)
  4. Observe that SHIFT-ENTER is working as expected.
  5. Hit ENTER.
  6. Observe that the cursor does not advance correctly.
  7. Continue typing.
  8. 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

mikebronner avatar Jun 11 '16 18:06 mikebronner

Can confirm, that Shift+Enter on Safari 9.1.2 @ OSX 10.11.6 Beta produces <p> not <br>.

kroko avatar Jul 13 '16 12:07 kroko

@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.

nmielnik avatar Jul 24 '16 06:07 nmielnik

Is there any news on the soft-return bug with Safari?

Thanks

yepecece avatar Aug 27 '20 14:08 yepecece

We're also experiencing this broken behaviour with Safari =/

FrittenKeeZ avatar Oct 22 '20 11:10 FrittenKeeZ