You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Desktop. Fix input methods on JBR, disable input methods when we lose focus (#881)
### Rerequest focus on main component when we need to type using input
methods
FixesJetBrains/compose-multiplatform#2628
The issue was because of 2 things:
- we used a hack to force a focused event
(`component.inputContext.dispatchEvent(focusGainedEvent)`
- JBR added optimization to ignore focus on the same element (thanks
@AiHMin for investigation
[here](JetBrains/compose-multiplatform#2628 (comment))).
In Compose we have only one element.
Because optimization is correct, and the hack depends on the internals,
it isn't right to fix it in JBR, we should fix it in Compose.
Furthermore, even without JBR changes, this hack didn't complete work -
we can't for example use it for disabling input methods (see the next
point).
In this PR we also use a hack unfortenutely - we refocus the root
component, focusing on invisible component first. That leads to another
issue with acccessibility, but we fix it
[here](#885)).
A proper fix should be switching to native code, or making an API in JBR
(but other vendors still be unsupported).
### Don't show input methods popup if there is no focused TextField
Previously we showed a popup, even if there are no focused textfield:

Now we don't show it if we isn't in a textfield.
P.S. only on Windows/Linux for now, on macOs Swing seems has [a
bug](JetBrains/compose-multiplatform#3839)
## Testing
Tested manually on:
1. Windows, Chinese/Korean/Japanese, OpenJDK/JBR 17, Accessibility
enabled/disabled, ComposeWindow/ComposePanel
2. macOs, Chinese, OpenJDK/JBR 17, Accessibility enabled/disabled
4. Linux, Chinese layout, OpenJDK 17
0 commit comments