Unblock AltGr+Oem2/5 typing inside ListBox #7729
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #7641
Description
ListBoxand classes derived from it (notablyListView) are expected to select all on Ctrl+/ and select item with focus on Ctrl+\. However, the implementation only checks the status of the Ctrl modifier, not the others. As a result, this shortcut hijacks any other combination of keys, most importantly Ctrl+Alt which is used for typing on around 60 keyboard layouts that Windows ships.This PR fixes the problem by limiting the shortcuts to what has been documented in the code comments as intent, i.e. they will work only when Ctrl is pressed and nothing else.
Customer Impact
Not taking this fix prevents users from typing characters using these two keys on their keyboards into a
TextBoxor similar control insideListBoxorListView.Regression
No.
Testing
Built and verified using the repro in #7641 and Czech keyboard layout that typing is not possible without the fix and works with the fix (.NET 8.0.100-preview.3.23178.7)
Risk
Selecting all and selecting the focused item is now limited to Ctrl only, while it used to work with any modifiers combination involving Ctrl.
However, the current situation is serious - users cannot type. The former behavior is relatively easily achievable by deriving from the control and overriding
OnKeyDown.