maui icon indicating copy to clipboard operation
maui copied to clipboard

UI sometimes becomes uninteractive with the mouse after selecting a file from a file input (.NET MAUI Blazor)

Open DennisvHest opened this issue 2 years ago • 10 comments

Description

Sometimes after selecting a file using a file input, the application can no longer be interacted with using the mouse. The application is not frozen however, because you can still interact with the keyboard.

It happens very inconsistantly. Sometimes I can reproduce it immediately, other times I have to select like 20 files before the bug occurs.

Once the bug occurs, the mouse interactivity can be restored by moving the mouse cursor out of the window. After that you can interact with the mouse again.

https://github.com/dotnet/maui/assets/18610083/28ba1536-86ce-4245-acaf-636b8fd051b1

Steps to Reproduce

  1. Create a File > New .NET MAUI Blazor App
  2. Add the following code to the index.razor page:
@page "/"

<input type="file" />
<b>Counter: @counter</b>
<button @onclick="IncrementCount">count</button>

@code {
    int counter = 0;

    void IncrementCount()
    {
        counter++;
    }
}
  1. Select a file using the file input
  2. Try to click the count button
  3. If you can still click the count button, repeat steps 3 and 4 (it might take like 20 times for the bug to occur)
  4. If the bug occurs (count button cannot be clicked), move the mouse outside of the window
  5. The count button can now be clicked again

Expected outcome: page stays interactive Actual outcome: page is no longer interactive using the mouse

Link to public reproduction project repository

https://github.com/DennisvHest/FileInputBugTest

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

Windows 10 22H2, Windows App SDK 1.3.230502000

Did you find any workaround?

Haven't found a workaround for this.

Relevant log output

No response

DennisvHest avatar May 13 '23 20:05 DennisvHest

I have same problem , when i fast input text to and change focus to other . App becomes uninteractive!!!

Makstvell avatar May 16 '23 10:05 Makstvell

I have same problem , when i fast input text to and change focus to other . App becomes uninteractive!!!

@Makstvell I had this issue aswell at first, but this has been fixed in an update to the Windows App SDK. You will have to manually update this in your application. https://github.com/MicrosoftEdge/WebView2Feedback/issues/3003#issuecomment-1499349079

This issue might be related. I wasn't sure where to post this issue. I only use webview2 via .NET MAUI Blazor.

DennisvHest avatar May 16 '23 11:05 DennisvHest

@DennisvHest Thank you very much. It works.

Makstvell avatar May 16 '23 11:05 Makstvell

Thanks for helping out with this, @DennisvHest !

mkArtakMSFT avatar May 17 '23 16:05 mkArtakMSFT

@mkArtakMSFT Why is this closed? My comment to @Makstvell was about a different issue. That other issue was fixed, but this issue still persists.

DennisvHest avatar May 17 '23 16:05 DennisvHest

@DennisvHest One more question, do you know how to fix when sometimes when open app -> black screen?

Makstvell avatar May 18 '23 12:05 Makstvell

@mkArtakMSFT issue can't be closed, because other issue was fixed.

Makstvell avatar May 18 '23 12:05 Makstvell

@DennisvHest One more question, do you know how to fix when sometimes when open app -> black screen?

@Makstvell No, I don't know. I have not experienced that issue in my project.

DennisvHest avatar May 18 '23 17:05 DennisvHest

There is this WebView2 issue with <input type="file"> that can cause the app to crash: https://github.com/MicrosoftEdge/WebView2Feedback/issues/3551

I wonder if the root issue is the same?

Eilon avatar Aug 04 '23 23:08 Eilon

Confirmed still repros with .NET 8.

Eilon avatar Jan 13 '24 00:01 Eilon

I have updated the reproduction project to .NET 8. Issue still persists, however now the application crashes instead of not being interactive using the mouse.

I cannot view the exception. Visual studio shows me this window: image

DennisvHest avatar Jan 14 '24 18:01 DennisvHest

Hi @DennisvHest. We have added the "s/try-latest-version" label to this issue, which indicates that we'd like you to try and reproduce this issue on the latest available public version. This can happen because we think that this issue was fixed in a version that has just been released, or the information provided by you indicates that you might be working with an older version.

You can install the latest version by installing the latest Visual Studio (Preview) with the .NET MAUI workload installed. If the issue still persists, please let us know with any additional details and ideally a reproduction project provided through a GitHub repository.

This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

ghost avatar Jan 18 '24 06:01 ghost

Verified this issue with Visual Studio Enterprise 17.9.0 Preview 3. the original problem does not repro, but the problem still recurs after the update. Screenshot 2024-01-18 142505 15072

Zhanglirong-Winnie avatar Jan 18 '24 06:01 Zhanglirong-Winnie

I have updated the reproduction project to .NET 8. Issue still persists, however now the application crashes instead of not being interactive using the mouse.

I cannot view the exception. Visual studio shows me this window: image

That is the behavior I 'expect' if the app is run with the debugger attached, and it's the issue I linked earlier: https://github.com/MicrosoftEdge/WebView2Feedback/issues/3551

But I was able to repro the original issue when I ran the app without the debugger attached. After closing the file dialog it would sometimes ignore several mouse clicks.

They could be the same underlying issue, but I'm not certain.

Eilon avatar Jan 20 '24 00:01 Eilon

This issue was moved to MicrosoftEdge/WebView2Feedback#4531

Eilon avatar May 03 '24 20:05 Eilon