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

Do not reset text selection when the TextBox loses focus #17195

Merged
merged 9 commits into from
Oct 25, 2024

Conversation

Gillibald
Copy link
Contributor

@Gillibald Gillibald commented Oct 4, 2024

What does the pull request do?

This PR removes some code that explicitly resets the current selection when the TextBox loses focus. We also no longer render the text selection when the TextBox has no focus to match what other frameworks do.

What is the current behavior?

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: #17151

Do not render selection highlight when the TextBox doesn't has focus
@avaloniaui-bot
Copy link

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

@avaloniaui-bot
Copy link

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

@avaloniaui-bot
Copy link

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

Copy link
Member

@MrJul MrJul left a comment

Choose a reason for hiding this comment

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

LGTM!
Do we want to introduce an option to keep the old behavior?

@maxkatz6 maxkatz6 added bug backport-candidate-11.2.x Consider this PR for backporting to 11.2 branch labels Oct 4, 2024
@Gillibald
Copy link
Contributor Author

We could add such option and change the default in a future release y

@rabbitism
Copy link
Contributor

rabbitism commented Oct 5, 2024

#11693 and #16825 can also be closed.

@Gillibald
Copy link
Contributor Author

#11693 and #16825 can also be closed.

Okay I will implement #11693 that looks to be a good change

@avaloniaui-bot
Copy link

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

@avaloniaui-bot
Copy link

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

@MrJul MrJul enabled auto-merge October 25, 2024 09:32
@MrJul MrJul added this pull request to the merge queue Oct 25, 2024
Merged via the queue into AvaloniaUI:master with commit 0944e04 Oct 25, 2024
10 checks passed
maxkatz6 pushed a commit that referenced this pull request Oct 27, 2024
* Do not reset the selected range when the TextBox loses focus
Do not render selection highlight when the TextBox doesn't has focus

* Invalidate TextLayout when the focus is lost

* Make ClearSelectionAfterFocusLost optional
Make inactive selection highlight optional

* Make sure changes to ShowSelectionHighlight invalidate the visual and text layout
@maxkatz6 maxkatz6 added backported-11.2.x and removed backport-candidate-11.2.x Consider this PR for backporting to 11.2 branch labels Oct 27, 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.

TextBox should not clear selection on focus loss
5 participants