Fix Avalonia Event Bubbling#521
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5f30ecd440
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| var currentPoint = e.GetCurrentPoint(this); | ||
| var button = MapPointerUpdateKind(currentPoint.Properties.PointerUpdateKind); | ||
| var result = Interaction.DispatchPointerPressed(skSvg, CreatePointerInput(e, button, e.ClickCount, 0)); |
There was a problem hiding this comment.
Restore pointer capture on press to avoid stuck SVG capture
Without capturing the Avalonia pointer on press, a PointerReleased that occurs outside this control will not be delivered here, so Interaction.DispatchPointerReleased(...) never runs to clear the dispatcher’s internal _capturedElement/_pressedElement state. In that path, later DispatchPointerMoved calls continue routing to the stale captured SVG element (_capturedElement ?? hitTarget), which breaks hover/cursor updates and event targeting after an outside release until another full press/release cycle happens.
Useful? React with 👍 / 👎.
|
@wieslawsoltes anything I can do to get a fix in? :) |
|
@JaggerJo Thanks for PR, sorry for long time to merge but have huge backlog of PRs for Svg.Skia |
No worries - thanks for all the OSS work 👏 |
Seems like the Focus refactoring in Avalonia v12 might have caused some issues with Pointer Capturing and Event Bubbling.We've been using version
1.0.0.18and recently updated to4.2.0. We just discovered that buttons with SVG icons in them are no longer clickable.I first thought this is related to focus refactoring in v12 - but it seems like this only has to do with changes / the addition of the interaction system.
↓ With Avalonia v12 + current master
↓ With the fix
Demo App
Project File