Skip to content

Make cursor respect the captured element#21421

Merged
MrJul merged 5 commits into
AvaloniaUI:masterfrom
MrJul:fix/pointerover-cursor
May 28, 2026
Merged

Make cursor respect the captured element#21421
MrJul merged 5 commits into
AvaloniaUI:masterfrom
MrJul:fix/pointerover-cursor

Conversation

@MrJul

@MrJul MrJul commented May 22, 2026

Copy link
Copy Markdown
Member

What does the pull request do?

This PR ensures that the cursor always comes from the captured element, if there's one (otherwise it reverts to the pointer-over element).

Unit tests have been added.

Note that this does not change the pointer-over behavior itself (in other words, #19156 is not affected by this PR).

What is the current behavior?

The cursor changes as soon as the pointer-over element changes, even if there's a capture.

What is the updated/expected behavior with this PR?

The cursor always comes from the captured element if there's one.

Fixed issues

@MrJul MrJul added bug regression customer-priority Issue reported by a customer with a support agreement. backport-candidate-12.0.x Consider this PR for backporting to 12.0 branch labels May 22, 2026
@avaloniaui-bot

Copy link
Copy Markdown

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

@ATZ-FR

ATZ-FR commented May 23, 2026

Copy link
Copy Markdown

Clicking on the text of a TextBox now permanently changes cursor to default.

@MrJul

MrJul commented May 26, 2026

Copy link
Copy Markdown
Member Author

Clicking on the text of a TextBox now permanently changes cursor to default.

Good catch thanks. I've tested a lot of dragging around, changing cursors on the fly, and missed this basic scenario :)

@MrJul

MrJul commented May 26, 2026

Copy link
Copy Markdown
Member Author

That scenario is now tested and fixed.

@avaloniaui-bot

Copy link
Copy Markdown

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

@ATZ-FR

ATZ-FR commented May 26, 2026

Copy link
Copy Markdown

Could you also check the case when clicking on non-text area of TextBox? The cursor flashes quickly on pointer release (changes from IBeam to default and back).

@MrJul

MrJul commented May 27, 2026

Copy link
Copy Markdown
Member Author

The cursor flashes quickly on pointer release (changes from IBeam to default and back).

That one was subtle. When the capture gets released, we don't have a new pointer-over element yet, causing the cursor to revert back for one frame. The pointer-over element is now updated immediately after the capture changes.

@avaloniaui-bot

Copy link
Copy Markdown

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

@ATZ-FR

ATZ-FR commented May 27, 2026

Copy link
Copy Markdown

Thank you, with the latest changes this issue is fixed AvaloniaUI/AvaloniaEdit#585

@MrJul MrJul added this pull request to the merge queue May 28, 2026
Merged via the queue into AvaloniaUI:master with commit fea03ca May 28, 2026
11 checks passed
@MrJul MrJul deleted the fix/pointerover-cursor branch May 28, 2026 09:15
MrJul added a commit to MrJul/Avalonia that referenced this pull request May 28, 2026
* Add failing test for cursor when pointer changes

* Introduce PresentationSource.CursorElement

* Update cursor on capture change

* Set correct cursor when capture is released

* Recompute pointer-over element immediately when capture changes
@MrJul MrJul added backported-12.0.x and removed backport-candidate-12.0.x Consider this PR for backporting to 12.0 branch labels May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backported-12.0.x bug customer-priority Issue reported by a customer with a support agreement. regression

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Regression] Mouse cursor changes to default arrow state on pointer pressed in v12

4 participants