feat: define ignoreCompositionState option to control composition events #1135
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
IMask correctly handles IME composition events by default, but this behavior can be problematic for certain mobile keyboards and user experiences. Many mobile keyboards (including Yandex, Xiaomi, Huawei default keyboards, and others) use composition events extensively, which can cause masking to work only after blur events rather than during real-time input.
This creates a poor user experience where users don't see immediate feedback while typing, especially on mobile devices where these keyboards are commonly used. While IMask's current behavior is technically correct, it's not always optimal for the end-user experience.
Related Issue: #1055
Solution
Added new
ignoreCompositionStateoption that allows developers to control how IMask handles IME composition events. This gives developers the flexibility to choose between:This is particularly useful for mobile applications where users expect immediate visual feedback while typing with keyboards that heavily use composition events.
Usage