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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
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.

return false
}

if (event.isTypedEvent) {
val codePoint = deadKeyCombiner.consume(event)
if (codePoint != null) {
Expand All @@ -97,6 +93,10 @@ internal abstract class TextFieldKeyEventHandler {
}
}

if (event.type != KeyEventType.KeyDown) {
return false
}

val command = keyMapping.map(event)
if (command == null || (command.editsText && !editable)) {
return false
Expand Down
Loading