UX: Clicking on a button in sidebar on mobile should collapse it (#18305)

This commit is contained in:
Alan Guo Xiang Tan 2022-09-21 11:25:54 +08:00 committed by GitHub
parent 4e1b9a225e
commit 04cdc2910d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -392,6 +392,15 @@ createWidget("revamped-hamburger-menu-wrapper", {
]; ];
}, },
click(event) {
if (
event.target.closest(".sidebar-section-header-button") ||
event.target.closest(".sidebar-section-link")
) {
this.sendWidgetAction("toggleHamburger");
}
},
clickOutside() { clickOutside() {
this.sendWidgetAction("toggleHamburger"); this.sendWidgetAction("toggleHamburger");
}, },

View File

@ -40,7 +40,7 @@ acceptance("Sidebar - Mobile - User with sidebar enabled", function (needs) {
await visit("/"); await visit("/");
await click(".hamburger-dropdown"); await click(".hamburger-dropdown");
await click(".sidebar-section-link-tracked"); await click(".sidebar-section-community .sidebar-section-header-button");
assert.ok( assert.ok(
!exists(".sidebar-hamburger-dropdown"), !exists(".sidebar-hamburger-dropdown"),