Skip to content
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 issue #12589 Keyboard tooltip of toolStripDropDown item keeps displaying when tab to other control #12750

Merged
merged 1 commit into from
Jan 14, 2025

Conversation

Epica3055
Copy link
Member

@Epica3055 Epica3055 commented Jan 10, 2025

Fixes #12589

Root cause

internal void UpdateToolTip(ToolStripItem? item, bool refresh = false)
{
if (!ShowItemToolTips || (item == _currentlyActiveTooltipItem && !refresh) || ToolTip is null)
{
return;
}
if (item != _currentlyActiveTooltipItem)
{
ToolTip.Hide(this);
if (!refresh)
{
_currentlyActiveTooltipItem = item;
}
}
if (_currentlyActiveTooltipItem is not null && !GetToolStripState(STATE_DRAGGING) && Cursor.Current is { } currentCursor)
{
Point cursorLocation = Cursor.Position;
cursorLocation.Y += Cursor.Size.Height - currentCursor.HotSpot.Y;
cursorLocation = WindowsFormsUtils.ConstrainToScreenBounds(new Rectangle(cursorLocation, s_onePixel)).Location;
ToolTip.Show(
_currentlyActiveTooltipItem.ToolTipText,
this,
PointToClient(cursorLocation),
ToolTip.AutoPopDelay);
}
}

ToolStrip.UpdateToolTip can be used to show or hide the ToolTip of ToolStrip.
But we didn't update tooltip when Enter key is hit on ToolStripItem.

Proposed changes

Update ToolTip when Enter key is hit on ToolStripItem

Screenshots

Before

Keyboard tooltip of toolStripDropDown item keeps displaying when tab to other control:

Image

ToolTipIssue.mp4

After

issues_12589_01.mp4

Test methodology

Manually

Microsoft Reviewers: Open in CodeFlow

@Epica3055 Epica3055 requested a review from a team as a code owner January 10, 2025 06:28
Copy link

codecov bot commented Jan 10, 2025

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 76.15329%. Comparing base (a54a4a9) to head (7e0c89e).
Report is 27 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main      #12750         +/-   ##
===================================================
+ Coverage   76.12836%   76.15329%   +0.02492%     
===================================================
  Files           3188        3192          +4     
  Lines         640086      640168         +82     
  Branches       47233       47237          +4     
===================================================
+ Hits          487287      487509        +222     
+ Misses        149269      149132        -137     
+ Partials        3530        3527          -3     
Flag Coverage Δ
Debug 76.15329% <0.00000%> (+0.02492%) ⬆️
integration 18.16708% <0.00000%> (ø)
production 50.05870% <0.00000%> (+0.04639%) ⬆️
test 97.02829% <ø> (+0.00001%) ⬆️
unit 47.27043% <0.00000%> (+0.02720%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Copy link
Member

@Tanya-Solyanik Tanya-Solyanik left a comment

Choose a reason for hiding this comment

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

@Epica3055 - please get this change tested by @Olina-Zhang's team

@Tanya-Solyanik Tanya-Solyanik added the waiting-for-testing The PR is awaiting manual testing by the primary team; no action is yet required from the author(s) label Jan 10, 2025
@Tanya-Solyanik Tanya-Solyanik removed the waiting-for-testing The PR is awaiting manual testing by the primary team; no action is yet required from the author(s) label Jan 13, 2025
@Epica3055 Epica3055 merged commit de5575c into dotnet:main Jan 14, 2025
8 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the 10.0 Preview1 milestone Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Keyboard tooltip of toolStripDropDown item keeps displaying when tab to other control
2 participants