trix icon indicating copy to clipboard operation
trix copied to clipboard

Starting a new paragraph in Safari sometimes doesn't insert text until after two keystrokes

Open pilaf opened this issue 1 year ago • 6 comments

Under some circumstances typing at the beginning of a new paragraph requires two keystrokes for text to start appearing.

Steps to Reproduce
  1. Open https://trix-editor.org/ in Safari
  2. Place caret at top of existing Trix document
  3. Enter two short paragraphs (a single character each is enough)
  4. Start a 3rd paragraph and type a single keystroke, it has no effect
  5. Type a second keystroke, suddenly two characters are inserted at once

Clearing the entire document and starting over removes the bug, but adding a single paragraph and then starting over from step 1 (at the top of document) brings the bug back. In other words, there must be text below the caret for the bug to trigger.

Details
  • Trix version: tried it on 2.0.7 through 2.0.10
  • Browser name and version: Safari 17.3.1
  • Operating system: macOS

pilaf avatar Mar 22 '24 13:03 pilaf

For what it's worth, I'm having trouble reproducing this.

I'm using Safari 17.4 on macOS Sonoma 14.4.

I went to https://trix-editor.org/.

I placed the caret at the top of the document.

I typed "x <RETURN>".

I typed "y <RETURN>".

I typed "z <RETURN>".

No issues.

Am I missing something?

michaellenaghan avatar Mar 27 '24 23:03 michaellenaghan

@michaellenaghan Odd, when I reported this the other day I could very easily reproduce it with just those steps in both trix-editor.org and my own app, but now I'm having to fool around a bit longer before it triggers.

In any case, I've now reproduced on two Macs, one with macOS 14.2.1 (Safari 17.2.1) and one with 14.3.1 (Safari 17.3.1), both with no Safari extensions installed.

I don't have exact steps yet but I think it may have to do with Safari's spelling suggestions, the bug seems to trigger more often right after I auto-correct a word. I'll keep trying to find a consistent way to reproduce it though.

I could also try to record my screen but I need to figure out how to include my keystrokes in the screencap...

pilaf avatar Mar 28 '24 00:03 pilaf

Here's a screencap with what I think is a sure way to reproduce it (I consistently reproduced it on both Macs this way). Better if you watch it with audio so you can hear the keystrokes.

Ignore my previous comment about spelling corrections, I think that was probably a red herring.

https://github.com/basecamp/trix/assets/38060/74de3a87-a576-4ed4-a000-e62693135eb7

pilaf avatar Mar 28 '24 00:03 pilaf

I tried doing exactly what you're doing, many times, but couldn't reproduce your result. Obviously, I don't know why! (Well, other than the obvious: we're using different versions of Safari.)

One thought: do you have any extensions running?

Btw, to be clear, I'm not affiliated with the project; I was just looking through the issues to get a feel for where the project is at.

michaellenaghan avatar Mar 28 '24 14:03 michaellenaghan

There was recently a bug that was affecting autocorrect edits in Safari, that we fixed in https://github.com/basecamp/trix/pull/1131., shipped in v2.0.10. It may be related.

afcapel avatar Mar 28 '24 16:03 afcapel

@michaellenaghan

One thought: do you have any extensions running?

No, zero Safari extensions in both machines that I tested on.

we're using different versions of Safari

Yeah, maybe it's been fixed in Safari 17.4, I'll update my machine and test again.

Btw, to be clear, I'm not affiliated with the project

I figured that a bit after replying to you 😅 , but still thanks for commenting as that ended up adding information to the ticket.

@afcapel

There was recently a bug that was affecting autocorrect edits in Safari, that we fixed in https://github.com/basecamp/trix/pull/1131., shipped in v2.0.10. It may be related.

AFAICT trix-editor.org's demo is using 2.1.0, so the fix you mention should be included, right? Yet I can reproduce this bug there.

pilaf avatar Mar 30 '24 10:03 pilaf