Repository navigation
Description
What’s broken?
On iOS Safari with the Japanese – Kana keyboard, a suggestion menu closes as soon as composing text is typed, so its items cannot be filtered in Japanese:
- The menu closes on the first composing character.
- If it is kept open, it closes again when the composition is committed.
What did you expect to happen?
The menu stays open and the query follows the composing text; after confirming, the query is the committed text.
Steps to reproduce
- Open a suggestion menu whose items are filtered by the query (e.g. a custom
@menu, or the slash menu). - With the menu open, type Japanese text with the Kana keyboard (do not confirm yet).
- Alternatively: type the text, pick a conversion candidate, and confirm.
BlockNote version
v0.57.0
Environment
Safari on iOS 27.2.1 (iPhone 12 Pro Max), Japanese – Kana (flick) keyboard, React 19, @blocknote/mantine
Additional context
Related
- request suggestion menu mentions to support CompositionEvent for chinese input #1283 — the original request (Chinese input in a mentions menu). It was closed in May 2026, but the behaviour is still there in 0.57.0, and the closing condition in the plugin state's
apply(newState.selection.from !== newState.selection.to) is the same onmainas of 2026-11-20. - fix: SuggestionPlugin support Composition event #1295 (open) and fix: keep suggestion menus open during IME composition #2731 (closed by its author) — pull requests for request suggestion menu mentions to support CompositionEvent for chinese input #1283.
- fix(react): preserve IME composition in menus and version names #3330 (merged, not released yet) — leaves the arrow keys and Enter to the IME in the React keyboard handlers. It does not change when the menu closes.
- Suggestion menu: trigger character typed during IME composition is inserted twice and the composition gets stuck (iOS Safari, Japanese Kana keyboard) #3376 — the trigger character being inserted twice during composition (same setup, reported separately).
We are opening a new issue because #1283 is closed and this report adds what happens on commit on iOS Safari (the marked text, sometimes including the trigger character, is deleted and re-inserted, and the trigger may come back as a different character). Happy to continue in #1283 instead if you prefer.
What we observed
- While composing, iOS Safari reports the marked text as a non-empty selection (e.g. selection
36–37for one character). The plugin state'sapplycloses the menu whenselection.from !== selection.to. - On commit, iOS sends
deleteCompositionText(the whole marked text is removed — including the trigger character if it is still part of the composition) and theninsertFromComposition, thencompositionend. During the delete stepselection.from < queryStartPos(), so the menu closes. When the trigger is part of the composition it may also come back as a different character (e.g.@→ full-width@).
Workaround we use
We wrap the plugin's state.apply: when it decides to close and the transaction belongs to a composition (tr.getMeta("composition") !== undefined || view.composing), we keep the previous state and recompute the query up to selection.to, as long as the selection has not moved before the trigger. After compositionend we check that the character at the trigger position is still a trigger and close otherwise. This needs access to plugin internals, so a fix upstream would be much appreciated.
Suggestion
While view.composing (or for transactions with the composition meta), do not close on a non-empty selection or on the transient delete/re-insert; re-evaluate after compositionend. Unlike #1295, updating the query during composition (up to the end of the marked range) is useful for menus that search as you type (e.g. reading "さくら" before it is converted).
Contribution
- I'd be interested in contributing a fix for this issue
Sponsor
- I'm a sponsor and would appreciate if you could look into this sooner than later 💖
Activity