question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot type `Key.Space` into a `TextBox` inside a `SelectingItemsControl`

See original GitHub issue

Describe the bug SelectingItemsControl.OnKeyDown handles certain KeyEventArgs events.

The event being marked as handled causes Avalonia.Win32.WindowImpl.AppWndProc to set its _ignoreWmChar field and not to raise an event when the WM_CHAR message is subsequently received, which finally causes Avalonia.Input.KeyboardDevice.ProcessRawEvent not to create a TextInputEventArgs event.

The space key is thus never seen by TextBox, even though it has keyboard focus when the key is pressed.

To Reproduce Create a window with this XAML:

<ListBox>
    <TextBox/>
</ListBox>

Try typing into the text box. You will not be able to type a space character.

Expected behavior Normal text input.

Desktop (please complete the following information):

  • OS: Windows 10
  • Version 11preview4

Issue Analytics

  • State:open
  • Created 10 months ago
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
timuniecommented, Jun 20, 2023

@workgroupengineering you are good to go. The PR will be accepted 👍

Thanks for looking into it.

🙏 Please add a unit test for this as we really need to make sure this will not happen again.

0reactions
workgroupengineeringcommented, Jun 20, 2023

Hi, I have a similar problem with the following xaml:

    <ListBox ItemsSource="{Binding Models}"
            Grid.IsSharedSizeScope="True">
      <ListBox.DataTemplates>
        <DataTemplate DataType="l:Model">
          <Grid>
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="Auto" SharedSizeGroup="a"/>
              <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <TextBlock Text="{Binding Id}"/>
            <TextBox Text="{Binding Description}"/>
          </Grid>
        </DataTemplate>
      </ListBox.DataTemplates>
    </ListBox>  

Regression is introduced with pr #11455 when keyboard interaction is moved from SelectingItemsControl to ListBox the fix for pr #9629 has been lost.

Can I redo the fix of pr #9629 on the ListBox?

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - TextBox ignores "Space" key input. Why?
When I put a breakpoint inside the "KeyDown" event handler and press "Space", the args.Key is "Unknown" ( args.PlatformKeyCode is "160"). I have ......
Read more >
Cannot type spaces into input within dropdown menu #8011
When placing an input within the top-bar element you can no longer type spaces into it. For example: "hello world" is not possible, ......
Read more >
Can't use the space key in text input fields [Archive]
(EDIT: When a different key is assigned to transport play, say Enter, then using Space in plugins works just fine! But curiously -...
Read more >
Cannot press spacebar in the textarea HTML element
The textarea never allows a space entry. I tried this solution and added game.input.keyboard.clearCaptures() but nothing happened. When I try to ...
Read more >
Logitech Combo Keyboard Space Key Issue
This problem appears when I'm typing in a text field, like this one. (I have had to hold the shift key and press...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found