microsoft / microsoft/microsoft-ui-xaml

Hyperlink's clickable space is much larger than its text

Open
#11,256 0 comments 2 reactions 0 assignees View on GitHub
bug needs-triage
Dominant language
C++
Stars
8.4k
Forks
942
Avg merge
2d 7h
Merged PRs (30d)
105

Description

### Describe the bug

When a `Hyperlink` is the last element of a `Paragraph` the rest of the whole line will be regarded as a part of the `Hyperlink`, will is clickable to navigate to that hyperlink.

### Why is this important?

The clickable space should match its text for visual consistency.

### Steps to reproduce the bug

1. Create a control like this
```xaml



HTML超文本標記語言 (Hyperlink in RichTextBlock)

```
2. Hover pointer over the empty space behind the hyper link
3. Observe the issue

### Actual behavior

The empty space behind the hyper link can trigger all behaviors of it.

### Expected behavior

The empty space behind the hyper link should not trigger any behavior of it.

### Screenshots

https://github.com/user-attachments/assets/0dc1d147-2c5c-4847-8911-ca554015b58f

### NuGet package version

Microsoft.WindowsAppSDK.WinUI 2.2.1

### Windows version

_No response_

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the Hyperlink, Paragraph, and RichTextBlock implementation and reproduce the behavior using the XAML example in this issue. Verify that the clickable bounds end at the hyperlink text rather than extending across the remaining line, and confirm that empty space no longer triggers hyperlink behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.