question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BlazorWebView - Mouse Events not being triggered in Android

See original GitHub issue

Description

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

  1. new .Net Maui Blazor App
  2. 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();
        } 
    }
}
  1. Add the component to Index.razor
  2. 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:open
  • Created a month ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
drasticactionscommented, Aug 21, 2023

@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.

0reactions
Secropcommented, Aug 21, 2023

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found