BlazorWebView - Mouse Events not being triggered in Android
See original GitHub issueDescription
Setting @onmouse* callbacks works as expected when running the app in a Windows machine, but in Android it doesn’t work (both emulator and physical device tested, in Debug and Release modes). Some times the event pass through, but it’s so slow that it becomes unusable, but most of the times it doesn’t work at all. This was tested using .Net calls like @onmouse* in Blazor components, but accessing the javascript counter parts with IJSRuntime produces the same effect.
Steps to Reproduce
https://github.com/Secrop/MauiBlazor_MouseEvent_Bug.App
- new .Net Maui Blazor App
- new Component with:
<div
style="width:200px;height:200px;border:1px solid black;user-select:none;"
@onmousedown="MouseDown"
@onmousemove="MouseMove"
@onmouseup="MouseUp"
@onmouseleave="MouseUp">
<div>X: @X</div>
<div>Y: @Y</div>
</div>
@code {
private double X;
private double Y;
private bool dragg = false;
private void MouseDown(MouseEventArgs args)
{
dragg = true;
}
public void MouseUp(MouseEventArgs args)
{
dragg = false;
X = -1;
Y = -1;
StateHasChanged();
}
public void MouseMove(MouseEventArgs args)
{
if (dragg) {
X = args.ClientX;
Y = args.ClientY;
StateHasChanged();
}
}
}
- Add the component to Index.razor
- Run the app in Android and click-drag inside the component.
Link to public reproduction project repository
No response
Version with bug
8.0.0-preview.7.8842 - thought 7.0.92 shows the same problem
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Android 11, 12, 13
Did you find any workaround?
No response
Relevant log output
No response
Issue Analytics
- State:
- Created a month ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Why are my mouse events not being triggered?
I can't seem to get the PreviewMouseDown event to work. I tried manually editing the code and it would not compile.
Read more >[Android WebView] Bluetooth mouse click in webview issue
The second problem is that it is possible to click on a web view when using a Bluetooth mouse even though touch is...
Read more >Wpf hyperlink open browser
AbsoluteUri); // cancel the event, and Frame cannot perform navigation operation. ... is being triggered at an interval through a timer and change...
Read more >Wpf webview
The WPF/WinForms BlazorWebView controls are being introduced in ... on older versions (WebViewCompatible) This event is triggered either.
Read more >Blazor demo
Client-side Blazor is not supported by Internet Explorer due to ... Zoom instructions: To zoom, use the mouse wheel/SHIFT + click and hold...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Secrop Having an entire reproduction project (as in, a complete project we can build) makes it easier for anyone to debug and identify the issue, and helps create an agreed codebase where we should both, hopefully, be able to see the same issue. Copy and pasting code can lead to cases where it can “happen” to work for one side, leading to a lot of back and forth. Also, if you create the reproduction project, that can be used as the base for test cases that can be added to this repo to prevent the error in the future, should it exist. For example, https://github.com/dotnet/maui/issues/16877, this person provided a full reproduction sample, which I could then check out, debug, and create my own example with a more root case reproduction.
That’s why I put the label on there.
@drasticactions Here’s a small project that procuces the error: https://github.com/Secrop/MauiBlazor_MouseEvent_Bug.App
It will run as expected in a Windows machine, but it will fail in an Android device/emulator. I haven’t tested IOS, or Tizen, so I cannot tell if this is exclusive for Android.