maui icon indicating copy to clipboard operation
maui copied to clipboard

Focus and blur event get triggered unnecessarily

Open Deepak-Ramakrisnan opened this issue 10 months ago • 9 comments

Description

When upgrading the MAUI.controls from version 8.0.7 to 8.0.20 , I'm facing the blur and focus event related issues and unexpected behaviors , Such as

1.While focusing the component again and again , focus and blur event get triggered even though component already in focused state

2.When component get focused out , focus event get triggered and also blur event get triggered twice

Steps to Reproduce

Case 1 :

1.Focus the component again and again without blurring it (mouse click again and again inside the input)

output: Now the focus and blur event triggered for every click unnecessarily

Case 2:

1.Focus and Focus out the element

Output : Now the focus event triggered once and blur event triggered twice

Link to public reproduction project repository

https://github.com/Deepak-Ramakrisnan/MAUI_Blur_Focus_issue

Version with bug

8.0.20 SR4

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

8.0.7 SR2

Affected platforms

Windows

Affected platform versions

Blazor Maui app

Did you find any workaround?

No response

Relevant log output

No response

Deepak-Ramakrisnan avatar Apr 15 '24 14:04 Deepak-Ramakrisnan

Verified on VS 17.10.0 Preview 3.0(8.0.20). Repro on Windows 11 with below Project: MauiBlazorApp.zip

XamlTest avatar Apr 16 '24 07:04 XamlTest

Can anybody confirm this: set the .NET SDK to 8.0.203 via global.json

"sdk": {
        "version": "8.0.203",
        "rollForward": "latestMajor"
    }

For me this seems to be working...

Edit: Today this isn't working anymore.. I have no clue why, I haven't changed anything...

ITaluone avatar May 24 '24 08:05 ITaluone

This issue resulted in us pulling back a new product launch. We have managed to deploy to production by pinning the MAUI version in the .csproj file, we did have to complete a full regression test of our application again, which delayed launch and has started to impact management's confidence in .NET MAUI.

This is a critical issue for us, as overall this resulted in key breaks for us in many areas.

  • Third-party control usages (SyncFusion)
  • Standard HTML Element Issues (Selects, and similar)
  • Standard HTML Behavior breaks that relied on these events (For us it was expand/collapse type actions)

Pinning back to <MauiVersion>8.0.7</MauiVersion> has resulted in allowing us to at least release to production, but any further versions forward and the functionality of our application is essentially toast across all platforms.

mitchelsellers avatar May 30 '24 02:05 mitchelsellers

@ITaluone You may try using a <MauiVersion> as we did, rather than an SDK pin, as that did not seem to help us.

mitchelsellers avatar May 30 '24 02:05 mitchelsellers

I believe this is related to a WinAppSDK bug: https://github.com/microsoft/microsoft-ui-xaml/issues/9288 which has been fixed and is being teed up for a 1.5 servicing release.

BethMassi avatar May 30 '24 15:05 BethMassi

Wow, I was going crazy trying to figure out why one of my components wasn't working correctly. Turns out blur was firing before it should have. Anyhow, this bug still exists in MAUI 8.0.40.

@BethMassi any idea on the timing of 1.5? This is a pretty big problem but I don't really want to lose the massive amount of other fixes between 8.0.7 and 8.0.40. The word fix currently appears 191 times on the first MAUI Releases Page.

thirstyape avatar May 30 '24 20:05 thirstyape

@thirstyape I just asked https://github.com/microsoft/microsoft-ui-xaml/issues/9288#issuecomment-2140894121 If the fix gets into servicing there then it would release on Jun 11. However, it won't flow into MAUI right away as we need to test it. You could reference a newer WinAppSdk package in your CSProj like:

 <ItemGroup Condition="'$(TargetFramework)'=='net8.0-windows10.0.19041.0'">
   <PackageReference Include="Microsoft.WindowsAppSDK" Version="1.5.3*" />
 </ItemGroup>

However, unless you are experiencing other issues with MauiVersion 8.0.7 then I'd recommend waiting until we pull it in.

BethMassi avatar May 30 '24 21:05 BethMassi

I can confirm that this is working again with 1.6 experimental by adding

<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">
    <PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.240531000-experimental1" />
</ItemGroup>

and

<WindowsSdkPackageVersion>10.0.22621.35-preview</WindowsSdkPackageVersion>

ITaluone avatar Jun 06 '24 05:06 ITaluone

This is working for me with the latest MAUI serving release 8.0.61 (which we bumped to use the WindowsAppSDK 1.5.4 servicing release).

BethMassi avatar Jun 28 '24 20:06 BethMassi

Ahm.. am I missing something? I bumped the MAUI version to 8.0.61 and removed the manual bump of the WASDK.

But it doesn't work since (when I look at the transitive resolved dependencies) MAUI.Controls -> MAUI.Core -> WindowsAppSDK 1.5.240311000 (which is the latest version with this bug)

image

Manually bump to <PackageReference Include="Microsoft.WindowsAppSDK" Version="1.5.240607001" /> fixes this issue (again)

ITaluone avatar Jul 08 '24 07:07 ITaluone

Sorry @ITaluone looks like it's fixed in SR7 (8.0.70) which released to NuGet today. https://github.com/dotnet/maui/blob/release/8.0.1xx-sr7/eng/Versions.props#L63

BethMassi avatar Jul 09 '24 17:07 BethMassi

Sorry @ITaluone looks like it's fixed in SR7 (8.0.70) which released to NuGet today.

No worries :) Just wanted to make sure there isn't an issue on my side

ITaluone avatar Jul 10 '24 05:07 ITaluone