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

Merged
merged 6 commits into from
May 25, 2024

Conversation

ijklam
Copy link
Contributor

@ijklam ijklam 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.

@ijklam
Copy link
Contributor Author

ijklam commented May 4, 2024

@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.

@ijklam
Copy link
Contributor Author

ijklam 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

@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.

@ijklam
Copy link
Contributor Author

ijklam commented May 6, 2024

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

@ijklam
Copy link
Contributor Author

ijklam commented May 9, 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.

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.

@ijklam
Copy link
Contributor Author

ijklam 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]

@ijklam
Copy link
Contributor Author

ijklam commented May 17, 2024

Is there any update?

@maxkatz6 maxkatz6 added this pull request to the merge queue May 21, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 21, 2024
@avaloniaui-bot
Copy link

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

@maxkatz6 maxkatz6 added this pull request to the merge queue May 25, 2024
Merged via the queue into AvaloniaUI:master with commit 4fdf4fa May 25, 2024
10 checks passed
@ijklam
Copy link
Contributor Author

ijklam commented Jul 9, 2024

When will this be contained in the Release?(In the 11.1.0 rc)

maxkatz6 added a commit that referenced this pull request Aug 12, 2024
…yboard again after closing it (#15603)

* [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

* change way to show soft keyboard

* add new api

---------

Co-authored-by: Max Katz <maxkatz6@outlook.com>
@maxkatz6 maxkatz6 added backported-11.1.x and removed backport-candidate-11.1.x Consider this PR for backporting to 11.1 branch labels Aug 12, 2024
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.

6 participants