Open
Description
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.
Sandbox
https://stackblitz.com/edit/vitejs-vite-2cjypt3y?file=src%2FApp.tsx
Steps
To reproduce the behavior:
- Enable a non-Latin (e.g. Korean) virtual keyboard on a Mac
- Click on the first text area
- Type the letter 'i' or a combination of 'i' and then 'f' to start the composition
- Move to another text area
- 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
}