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

Check whether event type is KeyDown after processing typed events. #1264

Merged
merged 1 commit into from
Apr 12, 2024

Conversation

m-sasha
Copy link
Member

@m-sasha m-sasha commented Apr 11, 2024

Proposed Changes

In BasicTextField2 input processing: Ignore non-KeyDown events only after processing typed events.
On the desktop, typed events are not KeyDown events, so checking for KeyDown first prevents processing typed events completely.

Testing

Test: Tested a BasicTextField2 manually.

@@ -76,10 +76,6 @@ internal abstract class TextFieldKeyEventHandler {
singleLine: Boolean,
onSubmit: () -> Unit
): Boolean {
if (event.type != KeyEventType.KeyDown) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the desktop, typed events are not KeyDown events

Since the changes in common:

  1. Will it still work on Android?
  2. Should we fix it in AOSP first?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. I think so.
  2. I'm talking to Zach about it.

Copy link
Collaborator

@igordmn igordmn Apr 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's slowly change our process to make a fix in AOSP first, and then cherry-pick it after merging to androidx-main.

And merge commonMain changes only if we need them soon.

Not sure about this fix. There are 2 factors:

  • we need to merge it before 1.6.10-rc01
  • the androidx-main code might be changed a lot right now and isn't worth upstreaming. So we just fix a small bug for just 1.6.10

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part of the code hasn't changed in androidx-main tip, so it's a very easy upstreaming.

@m-sasha m-sasha force-pushed the m-sasha/fix-btf2-input-processing branch from ff2c78a to cc80000 Compare April 12, 2024 10:36
@MatkovIvan MatkovIvan merged commit 3e5ff0c into jb-main Apr 12, 2024
6 checks passed
@MatkovIvan MatkovIvan deleted the m-sasha/fix-btf2-input-processing branch April 12, 2024 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants