microsoft / microsoft/microsoft-ui-xaml

NumberBox will sometimes not respond to input from the keyboard

Open
#10,286 11 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

Sometimes, the NumberBox control (`Microsoft.UI.Xaml.Controls.NumberBox`) will not properly take input from the keyboard. This happens after focusing the control, especially the first time the control is focused after it is given a value. When this bug occurs, the only way to get the control to accept input is either to un-focus and re-focus the control, or to use the arrow keys to move the cursor.

### Steps to reproduce the bug

I've found that this works best for applications that have been launched recently. It is more difficult (but not impossible) to reproduce a second or third time, even if the NumberBox is a different instance.

**NB**: This bug does not occur *every* time, but it is by no means rare.

1. Locate a NumberBox (e.g. in the WinUI 3 Gallery, winui3gallery://item/NumberBox)
2. If the NumberBox does not already have a value, enter a value
3. Un-focus the NumberBox
4. Re-focus the numberbox
5. Attempt to modify or delete the contents of the box

### Expected behavior

The highlighted value in the NumberBox should be overwritten by the number that was inputted to the box.

### Screenshots

_No response_

### NuGet package version

WinUI 3 - Windows App SDK 1.6.3: 1.6.241114003

### Windows version

Windows 11 (23H2): Build 22631

### Additional context

Bug has been present since at least WinAppSDK 1.6.240923002 (also tested in the latest, 1.6.241114003). I have been unable to reproduce it with WinUI 2.

Other factors considered:
* Appears on both .NET 8 and .NET 9
* Appears in both production and release
* Appears in several different apps from different publishers
* Appears across different machines running different Windows versions (Enterprise, Pro, etc)

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue in the WinUI 3 Gallery at winui3gallery://item/NumberBox, using Windows App SDK 1.6.3 on Windows 11 and following the listed focus and edit steps. Investigate the NumberBox control's keyboard and focus behavior; done means a selected value consistently accepts replacement or deletion immediately after refocusing, without requiring arrow keys or another focus change.

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
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.