Fix issue 14489: ToolStrip (TabStop=true) intercepts arrow keys after tab navigation, preventing TreeView from handling them#14491
Open
SimonZhao888 wants to merge 4 commits intodotnet:mainfrom
Open
Conversation
Member
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses a .NET 10/11 regression where a ToolStrip with TabStop=true can remain “active” in ModalMenuFilter after tab-navigation, causing arrow keys to be intercepted (e.g., preventing TreeView from handling them). The change narrows when a ToolStrip becomes active in menu mode and adds logic to clear the active ToolStrip when focus leaves ToolStrip context.
Changes:
- Gate
ModalMenuFilter.SetActiveToolStrip(this)inToolStrip.WndProc(WM_SETFOCUS)so it only runs for focus transitions originating from ToolStrip context (preserving #12916 behavior while avoiding #14489). - On
ToolStrip.OnLostFocus, remove the ToolStrip from the modal menu filter and potentially exit menu mode when focus moves outside ToolStrip context.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
LeafShi1
reviewed
Apr 24, 2026
Member
LeafShi1
left a comment
There was a problem hiding this comment.
Thanks for the fix, @SimonZhao888! The approach of gating SetActiveToolStrip on ToolStrip-context focus transitions and clearing on WM_KILLFOCUS makes sense. I have a few observations below.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 #14489
Proposed changes
Customer Impact
Regression?
Risk
Screenshots
Before
ToolStripIssue.mp4
After
2026-04-24.141412.mp4
Test methodology
Test environment(s)
Microsoft Reviewers: Open in CodeFlow