phoenixframework / phoenix_live_view

Rich, real-time user experiences with server-rendered HTML
https://hex.pm/packages/phoenix_live_view
MIT License
5.98k stars 901 forks source link

Form updates break character composition mode in Safari #3322

Open woylie opened 1 week ago

woylie commented 1 week ago

It appears that form updates break the character composition mode for Japanese input sources (and potentially other input sources with character composition) in Safari under certain conditions.

Environment

Setup

The demo application (https://github.com/woylie/jp_input) was generated with mix phx.server and mix phx.gen.live. Other than replacing type="text" with type="textarea", no changes were made.

  1. git clone https://github.com/woylie/jp_input
  2. cd jp_input
  3. mix setup
  4. mix phx.server
  5. Add Japanese - Romaji as an input source as described here: https://support.apple.com/guide/japanese-input-method/set-up-the-input-source-jpim10267/mac

Reproduction

  1. Open http://localhost:4000/things in Safari.
  2. Switch to the Japanese input source.
  3. Click Edit on the existing thing.
  4. Place the cursor at the end of the first line and hit return to create a new line in the middle.
  5. Type d and then e.

What should happen

The thick underline indicates character composition mode, in which you can choose different candidates with the space key.

What really happens

Observations

Resources

woylie commented 1 week ago

More resources regarding IMEs and JavaScript:

SteffenDE commented 3 days ago

@woylie can you please try {:phoenix_live_view, github: "phoenixframework/phoenix_live_view", branch: "sd-input-composition", override: true}?

SteffenDE commented 3 days ago

I'm not familiar with composition mode, but the idea is to skip sending an event to the server while compositing and only trigger the regular phx-change after it is finished.