microsoft / microsoft/microsoft-ui-xaml
MenuFlyout not constraining to root bounds when part of a CommandBar's secondary commands
- Dominant language
- C++
- Stars
- 8.4k
- Forks
- 942
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 105
Description
### Describe the bug
When you add a MenuFlyout to an AppBarButton that's part of the secondary commands of a CommandBar, the flyout won't be constrained to the root bounds even if ShouldConstrainToRootBounds is set to true.
### Steps to reproduce the bug
1. Create a CommandBar
2. Add an AppBarButton to its SecondaryCommands
3. Add a MenuFlyout with items to the AppBarButton
4. Set ShouldConstrainToRootBounds of the MenuFlyout to true
5. Start the app, make sure its not maximized, then open the flyout
### Expected behavior
Flyout should be within the app window
### Screenshots


### NuGet package version
None
### Windows version
Windows 11 (22H2): Build 22621
### Additional context
Setting the "Placement" property of the Flyout also doesnt work as expected :/
I was initially trying to figure out why my flyout was overlapping its AppBarButton only on Windows 10. When you open a flyout while the app is maximized, expected behavior is for it to display somewhere outside the button (i.e to the left or top), but on Windows 10, it covers part of the button. And only happens when it's the secondary command of a CommandBar.
Contributor guide
Research direction
Reproduce the issue using the listed CommandBar, secondary AppBarButton, and MenuFlyout steps on a non-maximized Windows app. Trace the CommandBar secondary-command and MenuFlyout placement or constraint behavior, then verify that ShouldConstrainToRootBounds keeps the flyout inside the app window and that placement avoids covering the button in the reported cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- desktop, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100