trix icon indicating copy to clipboard operation
trix copied to clipboard

Ordered/unordered list doesn't add new list item on newline (Android/Chrome)

Open hutchike opened this issue 3 years ago • 3 comments

When using Android/Chrome, and adding items to a list, the "newline" (return) key doesn't cause a new list item to appear, but instead the current list item is continued over 2+ lines.

Steps to Reproduce
  1. Use your Android phone and open Chrome
  2. Go to trix-editor.org
  3. Go to a blank line in the Trix editor input field
  4. Tap/click the "unordered list" format button
  5. You'll see a bullet appear as you now write the first list item
  6. Write some text in the first list item
  7. Tap/click newline (return)
  8. A new list item will not appear! :-( [yet it does in Chrome on Mac OS/X]
Details
  • Trix version: latest
  • Browser name and version: Chrome (latest)
  • Operating system: Android

hutchike avatar Mar 04 '22 16:03 hutchike

I'm also experiencing this issue.

hutchike avatar Feb 18 '23 22:02 hutchike

Found this issue on Basecamp Android app too. Need to tap enter / return key twice to create the second list item

achmiral avatar Feb 22 '23 13:02 achmiral

I found the cause, and I've fixed it via a nasty hack in my own editor implementation at jots.co but it's not an easy fix.

The problem is caused by the insertCompositionText event in the level_2_input_controller.js in the Trix source code - basically Chrome on Android sends composition text events (i.e. unfinished text fragments) because of the way the "keyboard" works on Android. This is why you need 2 newlines on Android to get a new bullet list item or number list item.

I can see why the Trix team hasn't fixed it (yet). It's caused by the architecture choice of Trix whereby it attempts to maintain a mirror copy of the contents of a "contenteditable" element (the editor) by listening to the events it emits. With Chrome/Brave on Android, the events are "composition text" events, which messes up the connection compared to the other user agents and operating systems.

(If you'd like access to jots.co just email [email protected])

hutchike avatar Feb 22 '23 21:02 hutchike