Repository navigation
Conversation
Use document-level event delegation so the generated navigation menu continues to close after interactive hydration replaces its prerendered elements. Add a browser regression test for element replacement. Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]> Copilot-Session: a01ff8c4-c002-4166-89d5-8264fe93ccc5
Co-authored-by: Copilot App <[email protected]> Copilot-Session: a01ff8c4-c002-4166-89d5-8264fe93ccc5
Co-authored-by: Copilot App <[email protected]> Copilot-Session: a01ff8c4-c002-4166-89d5-8264fe93ccc5
|
Did this PR get replaced by #68768 and can be closed now? |
kubaflo
left a comment
There was a problem hiding this comment.
Current-head review — d969769a7cfca6e7434940c40da0e9eba81cbeb7 (draft)
[P2] Keep the shared menu assertion compatible with standalone WebAssembly — src/ProjectTemplates/test/Templates.Blazor.Tests/BlazorTemplateTest.cs:348–354. TestBasicInteractionAsync now invokes this helper for every caller with Home enabled, including BlazorWasmStandaloneTemplate_Works and the PWA paths in BlazorWasmTemplateTest. The standalone navigation menu uses a <button class="navbar-toggler" @onclick="ToggleNavMenu"> and a collapse class, not a checkbox. Locator.IsCheckedAsync() is a checkbox/radio assertion and errors on that button. Thus the new shared test fails those existing template scenarios before it can verify collapse. Assert the observable .nav-scrollable visibility for all templates, or keep checkbox assertions restricted to the checkbox-based template. Confidence: high; established from callers, supplied standalone markup, and the locator contract, not a claimed local browser reproduction.
Prior feedback / upstream disposition: The existing question about replacement is material: #68768 is merged (2026-09-01, 87d1567f9efffe8269c9db6bcef02af314e3e6d0) and changes the same template/sample/test surfaces with the same custom-element lifetime mechanism. Its shared test uses visibility rather than checkbox state. Reconcile this draft with that merged work rather than treating it as an independent unlanded fix. I have not closed the PR or changed a thread.
The custom-element handler itself resolves the current subtree at click time, attaches/detaches locally, and closes rather than toggles; the sibling CSS selector remains within the wrapper.
Validation and limits: Inspected all changed files, shared test callers, standalone menu source, narrow-screen CSS, and the merged replacement's diff. Frozen git diff --check passes. No local template build/browser run or visual/media validation was performed; the body describes private browser/E2E trials not independently reproduced here. CI/template/Components checks report success, but do not invalidate the concrete standalone-selector mismatch above or establish the claimed browser matrix.
Scope: GPT-6.1 Sol; no model campaign, product fix, approval, or merge-readiness claim.
Summary
<blazor-nav-menu>custom elementconnectedCallbackanddisconnectedCallback, so hydration replacements receive behavior without a document-global listenerchecked = false, which cannot accidentally reopen itThis follows the custom-element lifecycle pattern already used by Blazor client validation and keeps listener ownership and disposal local to each menu instance.
Fixes #68677.
Testing
Expected: False,Actual: True).2 passed, 0 failed, 0 skipped).BlazorWebAppGlobalandBlazorWebAppPerPagesamples./counterto/weather, changed the checkbox from checked to unchecked, hid the menu, and had zero failed requests, console errors, or page errors.