microsoft-ui-xaml: RichTextBlock hyperlinks do not work with touch on Windows 11

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

  • 2.7
  • 2.8.0-prerelease.210927001
  • Windows App SDK 1.0 (cc: @andrewleader)

Windows app type

UWP/Win32

Device form factor

Desktop

Windows version

Windows 11 22000.194 (RTM) and above

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 13
  • Comments: 26 (14 by maintainers)

Most upvoted comments

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

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.

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

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

I’ve asked the team to dive into this.

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

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/

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.

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

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.

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

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

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…

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?

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

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?

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.

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