Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Benrski opened this issue Mar 19, 2025 · 0 comments
Open

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

Benrski opened this issue Mar 19, 2025 · 0 comments

Comments

@Benrski
Copy link

Benrski commented Mar 19, 2025

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
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant