Repository navigation
fix(menubar): Sync MenuBar with WinUI 2.7.0 and track it - #26612
Conversation
|
Claude finished @MartinZikmund's task in 23s —— View job Review summary: PR #26612Verdict: ship after considering the two comments. There are no blockers. Findings: 0 high, 0 medium, 2 low (both inline). Overall
Not verified: I reviewed the diff by inspection only. I did not build or run tests. |
|
This pull request is merged. |
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
|
The build 247861 found UI Test snapshots differences: Details
|
fdbb649 to
50e8981
Compare
|
Claude finished @MartinZikmund's task in 14s —— View job Review summary: PR #26612 (updated after the
|
|
Claude finished @MartinZikmund's task in 11s —— View job Review summary: PR #26612Verdict: ship, with one tracked caveat. No blockers. Findings: 0 high, 1 medium, 0 low (inline). Cross-cutting notes
|
Brings the port in line with MenuBar.cpp and MenuBarItem.cpp: arrow keys move focus between items and skip disabled ones, the MenuBar root is the flyout's pass-through element, empty items open no flyout, visual states follow the WinUI order and items get PositionInSet/SizeOfSet. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TXMNu2vyo2nCA7nYdY9GPd
MenuBarItem no longer re-resolves its MenuBar on Loaded: OnApplyTemplate finds it, as in WinUI, and the pass-through and keyboard tests pass without the handler. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TXMNu2vyo2nCA7nYdY9GPd
Ports MenuBar_TestUI/MenuBarPage as a sample and covers the synced behavior: arrow-key focus skipping disabled items, empty items, the pass-through element and PositionInSet/SizeOfSet. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TXMNu2vyo2nCA7nYdY9GPd
Recorded at winui3/release/2.7.0. The theme XAML is verbatim upstream, so it is mirrored. Interaction tests stay unmapped. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TXMNu2vyo2nCA7nYdY9GPd
Ignored for now: the next flyout closes right after it opens, because the deferred Closed callback in FlyoutBase.RemoveFromOpenFlyouts hides the newly opened flyout (pre-existing, unrelated to the port). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TXMNtzaC5dx4oo2ZVG5BHB
VisualTreeHelper.CloseAllPopups and MenuBarItem.IsFlyoutOpen() are public on Uno only. Close popups through UITestHelper.CloseAllPopups and read the flyout's IsOpen on WinUI. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TXMNtzaC5dx4oo2ZVG5BHB
a6840c1 to
d8602a3
Compare
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
|
Claude finished @MartinZikmund's task in 13s —— View job Review summary: PR #26612Verdict: ship, with one tracked caveat. There are no blockers. Findings: 0 high, 1 medium, 0 low. The medium is the existing inline comment on Cross-cutting notes
Not verified: I reviewed by inspection only. I did not build or run tests. I made no code changes. |
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
|
The build 248335 found UI Test snapshots differences: Details
|
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TXMNtzaC5dx4oo2ZVG5BHB
|
Claude finished @MartinZikmund's task in 11s —— View job Review summary: PR #26612 (after
|
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
|
The build 248359 found UI Test snapshots differences: Details
|
GitHub Issue: closes unoplatform/uno-private#2622
PR Type:
🐞 Bugfix
What changed? 🚀
This onboards MenuBar to the WinUI port sync (
build/winui-sync/areas/menubar.json) atwinui3/release/2.7.0, after bringing the port up to that release.Starting point
winui3/release/1.8.4in their headers. The other five files had no header.src/. Between 1.8.4 and 2.7.0, onlyMenuBar.vcxitemschanged (not applicable).67723ef2d, theMenuBarItemForegroundtheme resource) predates 1.8.4, and Uno's theme XAML already has it.The headerless files turned out to be an older WinUI 2 era port, so the line-by-line review found real gaps (below).
Upstream changes
MenuBar.vcxitems(+9)MenuBar_InteractionTests/*(inside the mapped source folder)Nothing was skipped, so there is no skipped-items issue.
Review (2.7.0 vs Uno)
MenuBar.cpp/.hMenuBar.csItemsis anObservableVectorwhoseVectorChangedupdatesPositionInSet/SizeOfSet(UpdateAutomationSizeAndPositionwas missing);RequestPassThroughElementwas missing;SetUpTemplatePartssplitMenuBarItem.cpp/.hMenuBarItem.csOnApplyTemplateasks the MenuBar for its pass-through element (was#if false, so the flyout never had one) and detaches handlers before attaching.OnMenuBarItemKeyDownignores keys while Alt is down; Left/Right now move focus (MoveFocusTo) and mark the event handled.OnPresenterKeyDownleaves Left/Right to aMenuFlyoutSubItemwith items.ShowMenuFlyoutopens nothing whenItemsis empty (it used to show an empty popup) and replaces the presenterKeyDownhandler instead of adding one on every open.OpenFlyoutFromusesFocusAndReturnNextFocusableItem, which was missing, so disabled items are skipped.OnFlyoutOpeningfocusesProgrammatic(wasPointer).UpdateVisualStateschecks Pressed > PointerOver > Selected/Normal (Selected came first). The deadIsFlyoutShowOptionsAvailablebranch is gone.EnterImpl/LeaveImpl(Uno specific:Itemsis not aDependencyObject, so its keyboard accelerators are entered explicitly);IsFlyoutOpen()andInvoke()are public in Uno, implementation-only in WinUI (marked, kept to avoid an API break);OnPresenterKeyDownchecksCount > 0before[0](marked)MenuBarItemFlyout.cpp/.hMenuBarItemFlyout.csMenuBarAutomationPeer.cpp/.hMenuBarAutomationPeer.csMenuBarItemAutomationPeer.cpp/.hMenuBarItemAutomationPeer.csascasts are direct casts, like upstreamMenuBar.idlMenuBarItem.Properties.cs,MenuBar.csMenuBar.Itemsis get-only like the IDL (its setter was private)MenuBarItem.h(FlyoutLocation)FlyoutLocation.csMenuBar.xaml,MenuBarItem.xaml,MenuBar_themeresources.xamlPriorityDefaultMenuBar_TestUI/MenuBarPage.xaml(.cs)MenuBarTests/MenuBarPageTODO Uno: no TestPage frame in SamplesApp)Workarounds
MenuBarItemLoadedhandlerOnApplyTemplatefinds the MenuBar, as in WinUIMenuBarItem#if false AddPassThroughElementWhen_Flyout_Open_Then_MenuBar_Root_Is_Pass_Through_ElementMenuBarItem.EnterImpl/LeaveImplItemsisn't a DO, soEnterSparsePropertiesdoesn't reach it; theKeyboardAcceleratorTestsMenuBar tests cover itShowMenuFlyoutIsFlyoutShowOptionsAvailablebranchFlyoutShowOptionsNot fixed here (pre-existing)
With a MenuBarItem flyout open, Right/Left moves focus to the next enabled item and opens its flyout, which then closes immediately.
FlyoutBase.RemoveFromOpenFlyoutsdefers itsClosedcallback, which then hides_openFlyouts[0]. By the time it runs, that is the newly opened flyout.ShowAtretargeting). The old port ran the same close-then-show sequence, so this is pre-existing.Given_MenuBar.When_Flyout_Open_And_Right_Arrow_Then_Next_Flyout_Openscovers it and is[Ignore]d until that fix lands, tracked in MenuBar: Left/Right with a flyout open opens the next item's flyout, which closes immediately #26654. Right is not handled twice: a probe showed the key never reaches the MenuBarItems'KeyDownhandlers while the flyout is open, so onlyOnPresenterKeyDownacts on it.Tests (Skia desktop)
Given_MenuBar, 6 tests. 4 fail on the old port and pass on the new one; the 6th is the ignored next-flyout test above.Given_MenuBar,Given_MenuFlyout,Given_Flyout.Test_Flyout_Binding_In_MenuFlyoutItem, the 3 MenuBarKeyboardAcceleratorTests, the wholeGiven_FrameworkElement_And_Leaksuite (including MenuBar) andGiven_ControlsLibraryAutomationPeerClassName.Uno.UI.RuntimeTests.Genericand the SamplesApp desktop head are clean.detect.ps1reportsmenubarup to date, andbuild/winui-sync/tests/run.ps1passes 134/134.PR Checklist ✅
Screenshots Compare Test Runresults.🤖 Generated with Claude Code
https://claude.ai/code/session_01TXMNu2vyo2nCA7nYdY9GPd