microsoft / microsoft-ui-xaml

Windows UI Library: the latest Windows 10 native controls and Fluent styles for your applications
MIT License
6.18k stars 667 forks source link

RichTextBlock hyperlinks do not work with touch on Windows 11 #6513

Closed riverar closed 10 months ago

riverar commented 2 years ago

Describe the bug

Tapping a Hyperlink present in RichTextBlock content does nothing on Windows 11.

Steps to reproduce the bug

  1. Install the XAML Controls Gallery app
  2. Open the XAML Controls Gallery app and navigate to the RichTextBlock sample. (Navigate to Text > RichTextBlock or use deep link xamlcontrolsgallery://item/RichTextBlock)
  3. Click the hyperlinks link in the second sample. Observe the browser opens.
  4. Tap the hyperlinks link in the second sample. Observe nothing happens.

Or create a blank app with one of the affected NuGet packages below.

Feedback Hub link from @marcant01: https://aka.ms/AAf9oe4

richtextblock_touch_g88

❌ This critically impacts app accessibility. Please strongly consider for servicing. (cc: @codendone)

Expected behavior

Similar or same behavior (hyperlink handler executes, browser opens, etc.) in both click and tap scenarios.

NuGet package version

Windows app type

UWP/Win32

Device form factor

Desktop

Windows version

Windows 11 22000.194 (RTM) and above

BreeceW commented 2 years ago

From what I can tell, this is caused by CommonStyles/Hyperlink_themeresources.xaml#L23 <x:Boolean x:Key="HyperlinkUnderlineVisible">False</x:Boolean>. Setting this value to True resolves the problem. Interestingly, despite the name, HyperlinkUnderlineVisible does not seem to affect whether the hyperlink underline is visible. This problem affects WinUI 2 and WinUI 3 in the same way. It looks like HyperlinkUnderlineVisible was added in Windows 11, as it is present and set to True in the generic.xaml file for 10.0.22000.0.

In my opinion, just strike the HyperlinkUnderlineVisible line in the WinUI style, since a) it didn’t work anyway, and b) it would resolve this issue, which is a major usability concern.

asklar commented 2 years ago

CC @ranjeshj

asklar commented 2 years ago

@gegao18 I think this one's already fixed?

riverar commented 2 years ago

Looks like latest dev build 22572 has a mitigation. I really hope this is also going into servicing pipeline for existing Windows 11 installs.

Mitigated an issue where clicking hyperlinks in RichTextBlocks wasn’t working when performed with touch or pen.- https://blogs.windows.com/windows-insider/2022/03/09/announcing-windows-11-insider-preview-build-22572/

MarcAnt01 commented 2 years ago

I am on 22581 and nothing changed. I don't understand why this has constantly being ignored when it's simply a one link patch as @BreeceW has shown, in the meanwhile a lot of users cannot open links without a keyboard or a mouse attached and ofc they blame the application developers. I understand you are looking for a fix rather than a patch, but leaving users with a broken behavior in the meanwhile sounds like a really bad decision. For a bug like this one, even affecting accessibility I think the minimum that could be done is releasing a patch in the next winui release

Calphalon commented 1 year ago

I there any update to this? Over a year ago it was noted as being fixed in an upcoming W11 build and it is still not. I am almost finished with a UWP app with over 300 RTB hyperlinks and, now that I am testing touch, I see none of them work with touch. It's useless to the end user on a touch device. But I did get Clip Champ.

riverar commented 1 year ago

@asklar @bpulliam Can one of you chase this down? Did the mitigation break?

MarcAnt01 commented 1 year ago

@asklar @bpulliam Can one of you chase this down? Did the mitigation break?

It looks like it started occurring again, yeah😔

bpulliam commented 1 year ago

I've asked the team to dive into this.

bpulliam commented 1 year ago

We have a fix for this regression in main. Next step is to get it into 1.3 servicing.

MarcAnt01 commented 1 year ago

We have a fix for this regression in main. Next step is to get it into 1.3 servicing.

How about UWP apps? Will they keep showing this bug for ever?

Calphalon commented 1 year ago

Is there any update for this issue? I am hoping to release my app soon and a whole section does not work with touch.

bpulliam commented 1 year ago

Fixed in 1.3.2

Calphalon commented 1 year ago

Sorry, but what does Fixed in 1.3.2 actually mean? It does not seem to have anything to do with my Windows Version. After digging it seems to refer to the Windows App SDK, but how does this fix WinUI2 UWP apps?

MarcAnt01 commented 1 year ago

I still find quite embarassing how this issue is being triaged, it's evident that is a bug affecting both UWP and WinUI 3, even inbox apps are broken for this reason, but you keep mentioning only WinUI 3 and WASDK.....

riverar commented 1 year ago

@bpulliam Is this going to be considered for OS servicing (UWP/WinUI 2)? Apps such as Mail are affected.

bogdan-patraucean commented 1 year ago

This is fixed and should be closed according to the latest release notes. Can somebody test?

riverar commented 1 year ago

No @bogdan-patraucean, this is not ready for closure. There is still the outstanding question of servicing this for UWP/WinUI 2 targets.

BreeceW commented 1 year ago

I realize in my earlier comment from 2021 that I did not make it clear that if this issue is blocking your app with WinUI 2, you can work around it by adding the following resource HyperlinkUnderlineVisible to your application resources in App.xaml.

<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <muxc:XamlControlsResources xmlns:muxc="using:Microsoft.UI.Xaml.Controls" />
            <ResourceDictionary>
                <x:Boolean x:Key="HyperlinkUnderlineVisible">True</x:Boolean>
            </ResourceDictionary>
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Application.Resources>

This lightweight style overrides the resource in WinUI 2’s default hyperlink style and tapping hyperlinks will start working again with touch.

With that said, it’s still important to fix this bug in the OS. A WinUI 2 update changing the hyperlink style as above would also mitigate the problem.

Calphalon commented 1 year ago

@BreeceW - Thanks for the clarification. I made the change, and (at first glance) it seems to work just fine for my app.

ranjeshj commented 10 months ago

Sorry, there are currently no plans to fix this in WinUI2. Please see this PR for more details - https://github.com/microsoft/microsoft-ui-xaml/pull/8761

MarcAnt01 commented 10 months ago

@ranjeshj I don't see how this issue is even related to the pr that has been linked

riverar commented 10 months ago

I think what @ranjeshj was trying to say was there's a new policy in effect and the team doesn't deem this business critical.

Because WinUI 2 is in maintenance mode, new bugs filed against it are closed unless they’re a security issue or are business critical.

ranjeshj commented 10 months ago

@riverar and @MarcAnt01 that is correct. This issue is fixed in WinUI3. The bar for servicing fixes into WinUI2 is very high as mentioned in the PR. That said, looking closer, the fix for this is in OS Xaml codebase not in WinUI2. So this would be an OS servicing fix :/

Calphalon commented 10 months ago

Business Critical for whom? The developers and the users, or is something else more important? I understand not adding new features, but this once worked and then was broken. So seems the right thing to do is put it back the way it is supposed to be.

MarcAnt01 commented 10 months ago

@riverar and @MarcAnt01 that is correct. This issue is fixed in WinUI3. The bar for servicing fixes into WinUI2 is very high as mentioned in the PR. That said, looking closer, the fix for this is in OS Xaml codebase not in WinUI2. So this would be an OS servicing fix :/

The team should revise the decision, imagine a big app like Whatsapp in the store, it's affected by this bug and I cannot open links with touch. I understand that Microsoft doesn't care about touch at all, but since this was broken at a certain point and the fix seems quite trivial, why cannot you address this instead of forcing all the devs to use a one-line fix?

The way Microsoft is handling this stuff not only degrades the user experience, but also contributes to increase the bad vision that most companies have of Microsoft.