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

[Android] [TextBox] fix a bug which cause cannot call out the soft keyboard again after closing it #15603

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Tangent-90
Copy link
Contributor

@Tangent-90 Tangent-90 commented May 4, 2024

[Android] fix a bug which cause closing soft keyboard does not clear focus on TextBox, which makes clicking on the TextBox cannot call out the soft keyboard again

What does the pull request do?

When the TextBox got focus, subscribe to IInputPane.StateChanged, to listen the keyboard closing event.
After the keyboard closed, remove the focus, and remove the subscribe to the event.

What is the current behavior?

After closing the soft keyboard, cannot call out it again by clicking on the TextBox, as it was focused already.
This behaviour might be related to #14736

Screenrecorder-2024-05-04-23-14-37-630.mp4

What is the updated/expected behavior with this PR?

After closing the soft keyboard, can call out it again by clicking on the TextBox.

How was the solution implemented (if it's not obvious)?

When the TextBox got focus, subscribe to IInputPane.StateChanged, to listen the keyboard closing event.
After the keyboard closed, remove the focus, so that the keyboard can be call out again.

Checklist

Breaking changes

Obsoletions / Deprecations

Fixed issues

…focus on TextBox, which makes clicking on the TextBox cannot call out the soft keyboard again
@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.2.999-cibuild0048072-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@cla-avalonia
Copy link
Collaborator

cla-avalonia commented May 4, 2024

  • All contributors have signed the CLA.

@Tangent-90
Copy link
Contributor Author

@cla-avalonia agree

@emmauss
Copy link
Contributor

emmauss commented May 6, 2024

Focus should not be cleared on the textbox when software keyboard is closed, because there may be ongoing operations that require the textbox to keep focus, like with an opened context menu. Instead, tapping the textbox should try to open the software keyboard if it's closed.

@Tangent-90
Copy link
Contributor Author

Focus should not be cleared on the textbox when software keyboard is closed, because there may be ongoing operations that require the textbox to keep focus, like with an opened context menu. Instead, tapping the textbox should try to open the software keyboard if it's closed.

Is there a way to open the soft keyboard? I am not familiar with the code base, and the removing focus behavior is the default behaviour before 11.1.x

@emmauss
Copy link
Contributor

emmauss commented May 6, 2024

Focus should not be cleared on the textbox when software keyboard is closed, because there may be ongoing operations that require the textbox to keep focus, like with an opened context menu. Instead, tapping the textbox should try to open the software keyboard if it's closed.

Is there a way to open the soft keyboard? I am not familiar with the code base, and the removing focus behavior is the default behaviour before 11.1.x

removing focus was the default, but it was buggy behavior, as explained in the pr you linked.

@Tangent-90
Copy link
Contributor Author

Can you guide me to make it can show soft keyboard? @emmauss

@emmauss
Copy link
Contributor

emmauss commented May 6, 2024

Can you guide me to make it can show soft keyboard? @emmauss

Currently, there is no API to directly show the input pane in avalonia, that's directly available to controls

@Tangent-90
Copy link
Contributor Author

Focus should not be cleared on the textbox when software keyboard is closed, because there may be ongoing operations that require the textbox to keep focus, like with an opened context menu. Instead, tapping the textbox should try to open the software keyboard if it's closed.

fixed

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.2.999-cibuild0048218-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@maxkatz6 maxkatz6 requested a review from emmauss May 9, 2024 13:10
@emmauss
Copy link
Contributor

emmauss commented May 9, 2024

A better option would be to add an api for TextInputMethodClient to trigger the software keyboard on demand.
I feel updating the focus manager itself could cause issues somewhere.

@Tangent-90
Copy link
Contributor Author

Tangent-90 commented May 9, 2024

A better option would be to add an api for TextInputMethodClient to trigger the software keyboard on demand.
I feel updating the focus manager itself could cause issues somewhere.

updated

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.2.999-cibuild0048256-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@Tangent-90
Copy link
Contributor Author

Is there any update?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-candidate-11.1.x Consider this PR for backporting to 11.1 branch bug os-android
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants