Skip to content

Fix issue 14489: ToolStrip (TabStop=true) intercepts arrow keys after tab navigation, preventing TreeView from handling them - #14491

Merged
SimonZhao888 merged 4 commits into
dotnet:mainfrom
SimonZhao888:Fix_issue_14489
May 6, 2026
Merged

SimonZhao888 merged 4 commits into
dotnet:mainfrom
SimonZhao888:Fix_issue_14489

Conversation

@SimonZhao888

@SimonZhao888 SimonZhao888 commented Apr 23, 2026 •

Copy link
Copy Markdown
Member

Fixes #14489, #14421

Proposed changes

Customer Impact

  • ToolStrip (TabStop=true) no longer intercepts arrow keys after tab navigation, and not preventing TreeView from handling them.

Regression?

  • Yes

Risk

  • minimal

Screenshots

Before

ToolStripIssue.mp4

After

2026-04-24.141412.mp4

Test methodology

  • Manually

Test environment(s)

  • .net 11.0.0-preview.2.final
Microsoft Reviewers: Open in CodeFlow

@SimonZhao888 SimonZhao888 changed the title Fix issue 14489 Fix issue 14489: ToolStrip (TabStop=true) intercepts arrow keys after tab navigation, preventing TreeView from handling them Apr 23, 2026
@dotnet-policy-service dotnet-policy-service Bot added the draft draft PR label Apr 23, 2026
@SimonZhao888
SimonZhao888 marked this pull request as ready for review April 24, 2026 06:17
@SimonZhao888
SimonZhao888 requested a review from a team as a code owner April 24, 2026 06:17
@SimonZhao888
SimonZhao888 requested a review from Copilot April 24, 2026 06:17
@SimonZhao888 SimonZhao888 removed the draft draft PR label Apr 24, 2026
@SimonZhao888

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) in ToolStrip.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.

@SimonZhao888 SimonZhao888 added the waiting-review This item is waiting on review by one or more members of team label Apr 24, 2026

@LeafShi1 LeafShi1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@SimonZhao888
SimonZhao888 requested a review from LeafShi1 April 27, 2026 02:18

@KlausLoeffelmann KlausLoeffelmann left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. If I understood correctly, the change is around ToolStrip (TabStop=true) intercepts arrow keys after tab navigation, preventing TreeView from handling them?

Thanks!

@SimonZhao888
SimonZhao888 merged commit 9341877 into dotnet:main May 6, 2026
8 checks passed
@SimonZhao888
SimonZhao888 deleted the Fix_issue_14489 branch May 6, 2026 01:14
@dotnet-policy-service dotnet-policy-service Bot removed the waiting-review This item is waiting on review by one or more members of team label May 6, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Accessibility] ToolStrip (TabStop=true) intercepts arrow keys after tab navigation, preventing TreeView from handling them (.NET 10 regression)

4 participants