Skip to content

onBlur not called while composing (Japanese or Korean) #5830

Open
@Benrski

Description

@Benrski

Description
The onBlur event is not properly handled during text composition with non-Latin input methods, such as Japanese or Korean.
It appears that this issue occurs only when the text area is empty.

Recording
Image

Sandbox
https://stackblitz.com/edit/vitejs-vite-2cjypt3y?file=src%2FApp.tsx

Steps
To reproduce the behavior:

  1. Enable a non-Latin (e.g. Korean) virtual keyboard on a Mac
  2. Click on the first text area
  3. Type the letter 'i' or a combination of 'i' and then 'f' to start the composition
  4. Move to another text area
  5. Notice that the onBlur event on the first text area is not triggered

Expectation
The Editable component should correctly trigger the onBlur event even while text composition is in progress.
It should match the default behavior of the HTML textarea, where the onBlur event is always called upon losing focus.

Environment

  • Slate Version: 0.112.x
  • Operating System: macOS
  • Browser: Chromium based (Chrome, Edge)

Context
Not sure if this could be the issue, but I've noticed that almost all events are handled after some other conditions, indicating that they are not consistently called.

if (
  readOnly ||
  state.isUpdatingSelection ||
  !ReactEditor.hasSelectableTarget(editor, event.target) ||
  // Not called because of `state.isUpdatingSelection`
  isEventHandled(event, attributes.onBlur)
) {
  return
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions