-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix 13633 by correct the logic of the method "OnSelectionChanged" of the ToolStripItemDesigner #13695
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix 13633 by correct the logic of the method "OnSelectionChanged" of the ToolStripItemDesigner #13695
Conversation
…the ToolStripItemDesigner
There was a problem hiding this comment.
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 refines the refresh logic in OnSelectionChanged
of ToolStripItemDesigner
so that a refresh only occurs when the first drop-down isn’t a ContextMenuStrip
, fixing focus issues with ToolStripTextBox
.
- Adjusted
needRefresh
to a conditional check instead of always true when on a drop-down. - Ensures
ContextMenuStrip
selections do not trigger unnecessary refreshes.
Comments suppressed due to low confidence (1)
src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/ToolStripItemDesigner.cs:996
- Add unit tests for
OnSelectionChanged
covering bothContextMenuStrip
and other drop-down scenarios to verify thatneedRefresh
is set correctly.
needRefresh = GetFirstDropDown(currentSelection) is not null and not ContextMenuStrip;
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #13695 +/- ##
====================================================
- Coverage 76.60680% 51.33223% -25.27458%
====================================================
Files 3253 2063 -1190
Lines 641011 287751 -353260
Branches 47442 42057 -5385
====================================================
- Hits 491058 147709 -343349
+ Misses 146303 137156 -9147
+ Partials 3650 2886 -764
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
Fixes #13633
Root Cause
The original logic, set the
needRefresh= true
directly when currentSelection.IsOnDropDown, this should be a bug in the code transplant process. The original code logic is here.Proposed changes
OnSelectionChanged
of the ToolStripItemDesignerCustomer Impact
Regression?
Risk
Screenshots
Before
ToolStripTextBox cannot get focus

After
ToolStripTextBox can be selected normally

Test methodology
Test environment(s)
Microsoft Reviewers: Open in CodeFlow