microsoft / microsoft/microsoft-ui-xaml

Unable to enter Chinese characters in Flyout TextBox when ShouldConstrainToRootBounds is False in WinUI.

Open
#11,412 1 comment 0 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

In a WinUI sample application, we attempted to enter Chinese characters into a TextBox hosted inside a Flyout.

The Flyout is opened when the user clicks a button, and it contains a TextBox for text input. The Flyout's **ShouldConstrainToRootBounds** property is **intentionally** set to **false** so that the **Flyout can be displayed outside the main window boundaries** for better usability.

However, when **ShouldConstrainToRootBounds** is set to **false**, Chinese characters **cannot** be **entered (type)** into the TextBox using the Chinese IME. Instead, only the English letters (for example, Pinyin input) are displayed in the TextBox. Interestingly, Chinese characters can still be **pasted** into the TextBox successfully.

When **ShouldConstrainToRootBounds** is set to **true**, both **typing and pasting** Chinese characters **work** as expected.

Since ShouldConstrainToRootBounds must remain false to allow the Flyout to render outside the main window, we would like to know the recommended solution or workaround for this scenario?

Simple Sample: [WinUIApp.zip](https://github.com/user-attachments/files/30583354/WinUIApp.zip)

### Why is this important?

Users who type in Chinese and other IME-supported languages should be able to enter text normally within the Flyout. Currently, when ShouldConstrainToRootBounds is set to false, IME character conversion does not work, which significantly impacts the usability of the application for users.

### Steps to reproduce the bug

1. Run the sample application.
2. Click the Open Flyout button.
3. Enter Chinese characters in the TextBox inside the Flyout.

**Note: To reproduce the issue, install the Chinese language pack on your device and set the display language to Chinese instead of English.**

**Image Reference:**

Image

### Actual behavior

The entered English letters are displayed in the TextBox instead of being converted to Chinese characters.

### Expected behavior

The Chinese characters corresponding to the entered English letters (Pinyin) should be committed and displayed in the TextBox.

### Screenshots

https://github.com/user-attachments/assets/8bea0c90-5b91-41c7-8ca2-aa81a9799626

### NuGet package version

1.0.3179.45 or net10.0-windows10.0.17763.0

### Windows version

Windows 11 (24H2): Build 26100

Contributor guide

Open the contributing guide

Research direction

Start with the attached WinUIApp.zip sample and reproduce the issue on Windows 11 with the Chinese language pack and IME. Compare typing and pasting in the Flyout TextBox with ShouldConstrainToRootBounds set to false and true; done means Chinese IME conversion works while the Flyout can still render outside the main window.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
desktop, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.