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

Desktop, macOs. Input methods always enabled, even if there is no TextField focused #3839

Closed
igordmn opened this issue Oct 19, 2023 · 1 comment
Labels
bug Something isn't working desktop input Touch, mouse, keyboard input related macos

Comments

@igordmn
Copy link
Collaborator

igordmn commented Oct 19, 2023

Compose 1.5.10, macOs (isn't reproducible on Windows/Linux)

  1. Install Chinese keyboard layout, choose it
  2. Open any Compose application
  3. Start typing
  4. See the popup

Expected
there is no popup

Actual
the input methods popup is shown, and users can type anything, even if it isn't received by any component
image

@igordmn igordmn added bug Something isn't working input Touch, mouse, keyboard input related macos desktop labels Oct 19, 2023
igordmn added a commit to JetBrains/compose-multiplatform-core that referenced this issue Oct 19, 2023
1. Fixes JetBrains/compose-multiplatform#2628
2. Doesn't show input methods popup if there is no focused TextField (only on Windows for now, on macOs, Swing seems has a bug: JetBrains/compose-multiplatform#3839)

## Testing
Tested manually on Windows/macOs/Linux, OpenJDK/JBR, Accessibility enabled/disabled
igordmn added a commit to JetBrains/compose-multiplatform-core that referenced this issue Oct 20, 2023
1. Fixes JetBrains/compose-multiplatform#2628
2. Doesn't show input methods popup if there is no focused TextField (only on Windows for now, on macOs, Swing seems has a bug: JetBrains/compose-multiplatform#3839)

## Testing
Tested manually on Windows/macOs/Linux, OpenJDK/JBR, Accessibility enabled/disabled
igordmn added a commit to JetBrains/compose-multiplatform-core that referenced this issue Oct 20, 2023
1. Fixes JetBrains/compose-multiplatform#2628
2. Doesn't show input methods popup if there is no focused TextField (only on Windows for now, on macOs, Swing seems has a bug: JetBrains/compose-multiplatform#3839)

## Testing
Tested manually on Windows/macOs/Linux, OpenJDK/JBR, Accessibility enabled/disabled
igordmn added a commit to JetBrains/compose-multiplatform-core that referenced this issue Oct 20, 2023
1. Fixes JetBrains/compose-multiplatform#2628
2. Doesn't show input methods popup if there is no focused TextField (only on Windows for now, on macOs, Swing seems has a bug: JetBrains/compose-multiplatform#3839)

## Testing
Tested manually on Windows/macOs/Linux, OpenJDK/JBR, Accessibility enabled/disabled
igordmn added a commit to JetBrains/compose-multiplatform-core that referenced this issue Oct 20, 2023
… focus (#881)

### Rerequest focus on main component when we need to type using input
methods
Fixes JetBrains/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:

![image](https://github.com/JetBrains/compose-multiplatform-core/assets/5963351/82e3543f-11f4-4013-8da5-d782b824ed2c)
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
igordmn added a commit to JetBrains/compose-multiplatform-core that referenced this issue Oct 20, 2023
… focus (#881)

### Rerequest focus on main component when we need to type using input
methods
Fixes JetBrains/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:

![image](https://github.com/JetBrains/compose-multiplatform-core/assets/5963351/82e3543f-11f4-4013-8da5-d782b824ed2c)
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
mazunin-v-jb pushed a commit to JetBrains/compose-multiplatform-core that referenced this issue Dec 7, 2023
… focus (#881)

### Rerequest focus on main component when we need to type using input
methods
Fixes JetBrains/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:

![image](https://github.com/JetBrains/compose-multiplatform-core/assets/5963351/82e3543f-11f4-4013-8da5-d782b824ed2c)
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
@okushnikov
Copy link
Collaborator

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working desktop input Touch, mouse, keyboard input related macos
Projects
None yet
Development

No branches or pull requests

2 participants