FIX: user menu bug when transit from narrow screen (#19310)

When narrow screen is enable and hamburgerVisible is set to true, transition to wide screen is breaking user-menu button.

We need to reset hamburgerVisible and domClean is a great way to achieve it.
This commit is contained in:
Krzysztof Kotlarek 2022-12-05 14:44:50 +11:00 committed by GitHub
parent 54424640e6
commit 425bebb337
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 0 deletions

View File

@ -42,6 +42,7 @@ const SiteHeaderComponent = MountWidget.extend(
@observes("site.narrowDesktopView")
narrowDesktopViewChanged() {
this.eventDispatched("dom:clean", "header");
if (
this.siteSettings.enable_experimental_sidebar_hamburger &&
(!this.sidebarEnabled || this.site.narrowDesktopView)

View File

@ -55,4 +55,30 @@ acceptance("Sidebar - Narrow Desktop", function (needs) {
bodyElement.style.width = null;
});
test("transition from narrow screen to wide screen", async function (assert) {
await visit("/");
await settled();
const bodyElement = document.querySelector("body");
bodyElement.style.width = "990px";
await waitUntil(
() => document.querySelector(".btn-sidebar-toggle.narrow-desktop"),
{
timeout: 5000,
}
);
await click(".btn-sidebar-toggle");
bodyElement.style.width = "1200px";
await waitUntil(() => document.querySelector("#d-sidebar"), {
timeout: 5000,
});
await click(".header-dropdown-toggle.current-user");
$(".header-dropdown-toggle.current-user").click();
assert.ok(exists(".quick-access-panel"));
bodyElement.style.width = null;
});
});