Skip to content

Fix ToolStripDropDownMenu scrolling when items are unavailable#14631

Open
SweathaBharathi wants to merge 3 commits into
dotnet:mainfrom
SweathaBharathi:Fix_Issue_7635
Open

Fix ToolStripDropDownMenu scrolling when items are unavailable#14631
SweathaBharathi wants to merge 3 commits into
dotnet:mainfrom
SweathaBharathi:Fix_Issue_7635

Conversation

@SweathaBharathi

@SweathaBharathi SweathaBharathi commented Jun 10, 2026

Copy link
Copy Markdown

Fixes #7635

Proposed changes

  • Updated ToolStripDropDownMenu.ScrollInternal(bool up) to skip items that are not available when calculating the scroll target and scroll delta.
  • Added helper logic to find the previous/next visible item instead of directly using adjacent items from the raw Items collection.
  • Fixed scroll boundary issues caused by hidden items (Available = false), including empty space at the top or bottom, overscrolling at the end of the list, and looping behavior when scrolling upward.

Customer Impact

  • Fixes incorrect ContextMenuStrip / ToolStripDropDownMenu scrolling when some items are hidden via Available = false, which previously could produce empty space at the top or bottom while scrolling.
  • Fixes boundary issues where scrolling could continue past the last visible item or fail to return to the first visible item when hidden items were present.

Regression?

  • No

Risk

  • No

Screenshots

Before

BeforeFix

After

AfterFix

Test methodology

  • Reproduced the original issue using a ContextMenuStrip with MaximumSize set small enough to enable scrolling and with one item added with Available = false before being inserted into the menu.
  • Verified scrolling behavior with hidden/unavailable items in the middle, at the first position, and at the last position of the collection.
  • Confirmed there is no extra empty space at the top or bottom, no incorrect growth at the scroll boundary, and no looping when scrolling upward.
  • Verified that menus without hidden/unavailable items still scroll normally and that both scroll buttons update correctly while moving through the visible item range.

Accessibility testing

  • This change does not introduce new controls or alter keyboard navigation semantics; it only corrects scroll positioning when hidden/unavailable items exist.

Test environment(s)

  • OS: Windows
  • SDK: 11.0.100-preview.3.26170.106
  • UI scaling: 100% / 150% / 125 % / 175%
Microsoft Reviewers: Open in CodeFlow

@SweathaBharathi SweathaBharathi requested a review from a team as a code owner June 10, 2026 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ContextMenuStrip has erroneous behavior if ToolStripMenuItem item Available=false

1 participant