microsoft / microsoft/microsoft-ui-xaml

MenuFlyout not constraining to root bounds when part of a CommandBar's secondary commands

Open
#10,088 1 comment 0 reactions 0 assignees View on GitHub
bug needs-triage
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

![Image](https://github.com/user-attachments/assets/3ad3a087-9c7b-4542-81a1-867b64344d7d)
![Image](https://github.com/user-attachments/assets/fb8cf334-c694-4f10-9144-0c3c2d505158)

### 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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.