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

Fix #13249 Mouse cursor on TextBox scrollbars shows as caret #13542

Merged
merged 12 commits into from
Nov 20, 2023

Conversation

RobertMut
Copy link
Contributor

What does the pull request do?

Fixes bug mentioned in #13249 "Mouse cursor on TextBox scrollbars shows as caret"

What is the current behavior?

When you move cursor over scrollbars it appears as normal pointer rather than caret

What is the updated/expected behavior with this PR?

Mouse pointer over scrollbar should appear as arrow.

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

Added arrow cursor setter to ScrollViewer.xaml

Checklist

Breaking changes

Obsoletions / Deprecations

Fixed issues

Fixes #13249

@RobertMut
Copy link
Contributor Author

@dotnet-policy-service agree

@MrJul
Copy link
Member

MrJul commented Nov 8, 2023

Thank you for your first contribution!

The selector isn't conditional at all here, so you can set Cursor="Arrow" directly on the needed controls inside the template instead.

That said, rather than specializing the ScrollViewer which can be used anywhere, why don't we fix the TextBox style itself to set the IBeam cursor on the inner panel directly, instead of the whole ScrollViewer? It's more of a general question, not directly addressed to you :)

@RobertMut
Copy link
Contributor Author

Thank you for your first contribution!

The selector isn't conditional at all here, so you can set Cursor="Arrow" directly on the needed controls inside the template instead.

That said, rather than specializing the ScrollViewer which can be used anywhere, why don't we fix the TextBox style itself to set the IBeam cursor on the inner panel directly, instead of the whole ScrollViewer? It's more of a general question, not directly addressed to you :)

@MrJul Thanks for feedback.
I've introduced changes you mentioned.
Waiting for the review to make sure we're on the same page :)

@MrJul
Copy link
Member

MrJul commented Nov 13, 2023

Thanks @RobertMut

As mentioned above, I believe we can have a local solution by fixing the TextBox's style instead.

Why? The idea here is to avoid changing the ScrollViewer globally, which isn't really specific to the TextBox and can be used anywhere. I know we're only talking about a Cursor here (which isn't really often overridden), but it's more of a general issue, making local, targeted, changes instead of global ones.

Are you interested in trying to fix the TextBox style instead?

It would involve setting the IBeam cursor on the necessary panel(s) instead of the TextBox's root, including the ScrollViewer. A transparent background might be required.

@RobertMut
Copy link
Contributor Author

Thanks @RobertMut

As mentioned above, I believe we can have a local solution by fixing the TextBox's style instead.

Why? The idea here is to avoid changing the ScrollViewer globally, which isn't really specific to the TextBox and can be used anywhere. I know we're only talking about a Cursor here (which isn't really often overridden), but it's more of a general issue, making local, targeted, changes instead of global ones.

Are you interested in trying to fix the TextBox style instead?

It would involve setting the IBeam cursor on the necessary panel(s) instead of the TextBox's root, including the ScrollViewer. A transparent background might be required.

Thanks for comment!
Finally got time to sit down. Now i changed TextBox, but in slightly different way. Modifying Panel got odd-looking result (i guess there is other part messing with it, but i didn't figured it out at this point), so did changes to ScrollViewer inside TextBox as you suggested.
The left ones are with IBeam on Panel, right - current changes.

@MrJul
Copy link
Member

MrJul commented Nov 19, 2023

Looking good!

After testing, the floating watermark (PART_FloatingWatermark) now has the default cursor instead of IBeam previously. Since it's "click-through" I believe it should be IBeam too.

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, thanks!

@MrJul MrJul added this pull request to the merge queue Nov 20, 2023
Merged via the queue into AvaloniaUI:master with commit e43311b Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mouse cursor on TextBox scrollbars shows as caret
2 participants