microsoft / microsoft/microsoft-ui-xaml
TextBox: Double-clicking the empty area after text does not select the closest word
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 8.4k
- Forks
- 942
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 105
Description
*This content was largely generated by AI. AI makes mistakes.*
### Describe the bug
Double-clicking the empty area after the text in a WinUI `TextBox` does not select any text. The expected behavior is to select the closest word, rather than requiring the pointer to be directly over the word.
### Why is this important?
Users expect to use double-click to select text for editing. Ignoring double-clicks in the unused portion of a text field makes selection less convenient and inconsistent with the behavior requested in the related UniGetUI report below.
### Steps to reproduce the bug
1. Display a `TextBox` that is wide enough to leave empty space after its text.
2. Enter `Hello world`.
3. Double-click the empty area to the right of `world`, inside the `TextBox`.
This is a minimal scenario for the reported behavior; a standalone reproduction project has not been attached.
### Actual behavior
No text is selected when double-clicking the empty area.
### Expected behavior
Select the closest word, which is `world` in this example, as if the user had double-clicked that word directly.
### Screenshots
Not provided.
### NuGet package version
Not yet recorded.
### Windows version
Not yet recorded.
### Additional context
The same symptom was reported in [UniGetUI #4160: Allow double clicking empty space in searchbox](https://github.com/Devolutions/UniGetUI/issues/4160).
That report specifically requests selecting the closest word when double-clicking the empty area after the text. The UniGetUI maintainer [closed it as not planned on October 5, 2025, attributing the behavior to WinUI](https://github.com/Devolutions/UniGetUI/issues/4160#issuecomment-3369188731). This issue tracks the behavior in the WinUI repository.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with a minimal WinUI TextBox reproduction using the reported steps, comparing a double-click directly on “world” with one in the empty area after it. Confirm the expected closest-word selection and inspect the relevant TextBox pointer and selection behavior; no source file or test is named in the report, and done means the empty-area double-click selects “world”.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100