dotnet / dotnet/wpf

WPF TextBox ignores/overrides certain keyboard input combinations

Open
#8,249 2 comments 0 reactions 0 assignees View on GitHub
:construction: work in progress
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

### Description

I'm running on Windows 11 (build 22621.2283) and have "Persian (Standard)" installed as one of my keyboard layouts. On this keyboard layout, key combinations Shift+Space is supposed to insert the Zero-Width Non-Joiner (ZWNJ, U+200C) character which is the correct syntactic replacement for the Space character in Persian.
The issue is that .NET WPF overrides default OS behavior and simply inserts a plain Space character instead.
I've checked and can confirm that the issue exists on .NET Framework 4.7.2, .NET 6.0, and .NET 7.0.

### Reproduction Steps

1. Make sure to have Persian installed in Windows Settings app and under "Time & language > Language & region"
2. Click the "..." button on "Persian" and choose "Language options"
3. Under the "Keyboards" section, install "Persian (Standard)" and optionally remove all other installed keyboard layouts for Persian
4. Create a WPF application and add a TextBox to the MainWindow
5. Run the app and try the following key-strokes in order (modifier keys are explicitly stated) using the aforementioned keyboard layout: [L] [D] [Shift+Space] [V] [H] [K] [L]
6. The resulting text should be "می‌رانم", but it is "می رانم" instead (notice the spacing)
7. Try and check the steps 5 and 6 on a Notepad instance to see how it should actually turn out

### Expected behavior

Insertion of the character ZWNJ upon pressing Shift+Space

### Actual behavior

A resulting Space character

### Regression?

_No response_

### Known Workarounds

_No response_

### Impact

_No response_

### Configuration

_No response_

### Other information

The ZWNJ character seems to me to be only one instance where the intended OS character gets overridden. It might be the case where other characters get overridden in other keyboard layouts.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.