microsoft / microsoft/microsoft-ui-xaml

`TextBox` inside a `ScrollViewer` does not lose focus when click in empty spaces

Open
#10,051 3 comments 3 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

`TextBox` inside a `ScrollViewer` does not lose focus when click in empty spaces, but a `TextBox` inside any other panel does.

### Steps to reproduce the bug

1. Use this xaml
```xml










```

### Expected behavior

_No response_

### Screenshots
![Image](https://github.com/user-attachments/assets/1e051c6d-27d8-4af0-ad66-51df6a43222d)

### NuGet package version
![Image](https://github.com/user-attachments/assets/6a677b05-337e-45e7-ae50-e6776cbe8806)

### Windows version

_No response_

### Additional context
Related #3825
[Repro](https://github.com/HO-COOH/WinUI-Bug/tree/main/19-TextBoxInsideScrollViewerNotLosingFocus)

Contributor guide

Open the contributing guide

Research direction

Start with the linked WinUI-Bug repro, especially the TextBox and ScrollViewer example, and compare it with the adjacent Grid case. Read related issue #3825 and use the repro to determine the expected focus behavior; done means the two layouts behave consistently when empty space is clicked.

Written by the indexing model from the issue text.

Assessment

Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.