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

Don't show text selector when no text is ready #15770

Merged
merged 1 commit into from
Jun 25, 2024
Merged

Conversation

emmauss
Copy link
Contributor

@emmauss emmauss commented May 20, 2024

What does the pull request do?

When there's no text in a textbox, tapping it will not show the selection handles.

What is the current behavior?

Text selectors always show even when there's no text to select.

What is the updated/expected behavior with this PR?

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

Checklist

Breaking changes

Obsoletions / Deprecations

Fixed issues

Fixes #15694

@avaloniaui-bot
Copy link

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

@robloo
Copy link
Contributor

robloo commented May 20, 2024

On Android with Samsung S23 (not using Avalonia) here is the functionality.

  1. First tap into empty textbox the cursor appears.
  2. Second tap into an empty textbox the cursor AND selection handle appears and the Paste, etc. Context menu opens.

I think you are oversimplifying this a bit and the selection handle is useful user feedback in some cases. At least it makes clear where the cursor is.

@emmauss
Copy link
Contributor Author

emmauss commented May 20, 2024

On Android with Samsung S23 (not using Avalonia) here is the functionality.

1. First tap into empty textbox the cursor appears.

2. Second tap into an empty textbox the cursor AND selection handle appears and the Paste, etc. Context menu opens.

I think you are oversimplifying this a bit and the selection handle is useful user feedback in some cases. At least it makes clear where the cursor is.

I'm only able to show the handles on an empty textbox when you long press. This both shows the context menu and the handle. Tapping doesn't. Imho, there isn't a purpose of the handle when the textbox is empty, as no selection can occur, and context menu will still show with long press

@robloo
Copy link
Contributor

robloo commented May 20, 2024

In Samsung OneUI this is what I see:

Single tap:

Tap once, wait and tap again:

Edit: And a purpose of this might be strong user feedback in the UI where text input will occur. This is easier to see than a blinking cursor in some cases. I also expect that the selection handles and context menu are always shown together.

We probably need to know what is done in iOS as well.

@emmauss
Copy link
Contributor Author

emmauss commented May 20, 2024

Yeah. We need to check how iOS handles it

@maxkatz6
Copy link
Member

maxkatz6 commented May 21, 2024

First tap into empty textbox the cursor appears.
Second tap into an empty textbox the cursor AND selection handle appears and the Paste, etc. Context menu opens.

On iOS:

  1. First tap shows the cursor
  2. Second tap shows the context menu, but not the selection handle
  3. Selection handle only appears if field is not empty, and user double tapped on the text (long press only moves the cursor).

Some apps (mostly, messengers) actually select all the text on second tap as well. But it seems to be a custom behavior.

@emmauss
Copy link
Contributor Author

emmauss commented May 21, 2024

Flutter seems to use the android behavior(long press to show handle and menu) when using the material theme, and no showing when using cupertino(ios)

@robloo
Copy link
Contributor

robloo commented May 21, 2024

Flutter matching the host OS behavior seems correct to me. That could definitely be debated though.

@maxkatz6 maxkatz6 added bug backport-candidate-11.1.x Consider this PR for backporting to 11.1 branch labels Jun 25, 2024
@maxkatz6 maxkatz6 merged commit fb4a839 into master Jun 25, 2024
12 checks passed
@maxkatz6 maxkatz6 deleted the text_selector_update branch June 25, 2024 19:45
@robloo
Copy link
Contributor

robloo commented Jun 25, 2024

So... the discussion was invalidated and we just merged as is?

@maxkatz6
Copy link
Member

@robloo on both iOS and Android selection handle doesn't appear when input is focused. Only on second tap with a difference whether field is empty or not (Android will show the handle when empty, iOS will show the handle when there is some text).
This PR makes first common part better by not showing it immediately.
I wouldn't keep this PR open until it gets platform specific implementations to complete second part, as it's not planned now.

We need an issue to track that though.

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Visibility of Text selection handles on empty TextBoxes on Android
4 participants