-
Notifications
You must be signed in to change notification settings - Fork 984
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
Fixing switching focus between ToolStrips where TabStop=true with Shift-Tab #5842
Fixing switching focus between ToolStrips where TabStop=true with Shift-Tab #5842
Conversation
88e8440
to
94d7ef9
Compare
src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ControlTests.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ControlTests.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ControlTests.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ControlTests.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ControlTests.cs
Outdated
Show resolved
Hide resolved
94d7ef9
to
8f6d774
Compare
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.
Could you please explain why tool strip is a special case?
src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ControlTests.cs
Show resolved
Hide resolved
ac280ca
to
5c34ffd
Compare
@Tanya-Solyanik, thank you very much for your review points! While fixing them I've got another solution for the issue and it seems to me more compact and consistent than the previous two. I have adapted the logic of the In the future PR I can refactor both of the I have manually tested the Also, I have manually tested all the controls at the child test forms called by these buttons: "Buttons", "ListView", "Calendar", "FontNameEditor", "Multiple Controls", "CollectionEditors", "ComboBoxes", "RichTextBoxes", "ComboBoxes with ScrollBars", "PictureBoxes", "Dialogs", "DataGridView", "FileDialog", "DataGridView in Virtual mode", "ErrorProvider", "Task Dialog", "ContentAlignment", "MessageBox", "Menus", "Panels", "TrackBars", "ScrollBars", "MDI Parent", "ToolTips", "PropertyGrid" (at our test application And I have run all unit tests for And just to be sure this solution doesn't affect moving focus when |
src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ToolStripTests.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ToolStripTests.cs
Show resolved
Hide resolved
src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ToolStripTests.cs
Outdated
Show resolved
Hide resolved
5c34ffd
to
de51a11
Compare
@ArtemTatarinov - thank you for the detailed description of testing! This is very helpful! |
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.
Looks good, please address the comment about localization.
…tem of the ToolStrip after switching to the next or previous ToolStrip control
de51a11
to
ad7773d
Compare
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.
Looks good
Tests failed in release:
|
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
Hello @Tanya-Solyanik! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
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.
Happy to oblige
…olStrips where TabStop=true with Shift-Tab (dotnet#5842)" (0405ba2)
…ft-Tab (port to 7.0) (#5964) * Revert only Control.cs from commit "Fixing switching focus between ToolStrips where TabStop=true with Shift-Tab (#5842)" (0405ba2) * Fixing moving focus backward with Shift-Tab at ToolStrip with TabStop=true. If we don't found any siblings, and the control is a ToolStripItem that hosts a control itself, then we shouldn't return its parent, because it would be the same ToolStrip we're currently at. Instead, we should return the control that is previous to the current ToolStrip. Debug.Asserts from 6.0 are replaced for Exceptions with localized strings (cherry picked from commit 0e53ce7)
Fixes #5795
Proposed changes
forward
block of theif
statement to thebackward
block - no special treatment for theToolStrip
is neededforward
condition at theGetNextItem
method at theToolStrip
class because it is called after moving focus to theToolStrip
, but whenTabStop
is true the first item should be always focusedCustomer Impact
Before the fix (focus was trapped at the last ToolStrip item while pressing
Shift
+Tab
):After the fix (focus isn't trapped at the last ToolStrip item while pressing
Shift
+Tab
):Regression?
Risk
Test methodology
Test environment(s)
Microsoft Windows [Version 10.0.19043.1237]
.NET SDK 7.0.0-alpha.1.21471.1
Microsoft Reviewers: Open in CodeFlow