microsoft / microsoft-ui-xaml

Windows UI Library: the latest Windows 10 native controls and Fluent styles for your applications
MIT License
6.3k stars 676 forks source link

TextBox that got focus by clicking on the Clear Button location does not accept key input #7703

Open hyam1567 opened 2 years ago

hyam1567 commented 2 years ago

Describe the bug

If focus is got by clicking on the "right side" of the TextBox, it does not accept key input. The "right side" is where the Clear Button appears. If you move the mouse pointer to the left, the TextBox accepts key input.

Steps to reproduce the bug

Place two fixed-width TextBlocks.

<TextBox x:Name="A" Width="200"/>
<TextBox x:Name="B" Width="200"/>

The operation is as follows.

  1. Enter some text into each TextBox.
  2. Focus on TextBox A.
  3. Click on the "right side" of TextBox B. Do not move the mouse pointer after clicking. Focus is shifted to TextBox B, but it does not accept key input. WinUI TextBox Focus
  4. Move the mouse pointer to the left. The TextBox accepts key input

Expected behavior

No response

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.1.4

Windows app type

Device form factor

Desktop

Windows version

Windows 11 (21H2): Build 22000

Additional context

No response

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 5 days.

Joost-Jens-Luminis commented 10 months ago

This is still an existing problem in the latest WinUI on .Net 8.0. Can this be reopened?

Joost-Jens-Luminis commented 10 months ago

For reference, this is the location where if you click, you will get focus but typing doesn't add what you type to the field. image

codendone commented 10 months ago

Thanks for that extra image, @Joost-Jens-Luminis. I'm able to repro this issue in the TextBox page of WinUI 3 Gallery. Reopening.

codendone commented 10 months ago

Additional note: When I repro this in W3G, moving the mouse to the left over the textbox selects the text, so it seems the TextBox is also confused in thinking that it was still in a PointerPressed state. The textbox also grew wider when the Clear button was added, which may have somehow triggered confusion.

Joost-Jens-Luminis commented 10 months ago

I am happy to hear that this has been reopenend. In addition to this, I am fairly sure this also happens in the NumberBox with the up/down buttons. We had that component in use originally and that is where we originally found this issue (we have since replaced the numberbox with a textbox and behaviour due to a bug in the numberbox but that is a separate known issue). You may want to add whatever solution you find here to the NumberBox as well.

If you want any more information or assistance, don't hesitate to ask.

p.s. This issue can also be replicated in the Windows 11 settings view (and probably other places as well).

Orfuze commented 4 months ago

Hello. I confirm that I have exactly the same problem with a NumericBox. I am using the V1.4.230822000 of WindowsAppSDK and .NET 7.

The problem occurs as soon as the first click is made on the X zone. Keyboard input is ignored until the mouse is moved. After that, the problem no longer seems reproducible.