From: SleeplessOne1917 <abias1122@gmail.com>
Date: Wed, 21 Jun 2023 00:09:45 +0000 (+0000)
Subject: Fix mobile navbar bug (#1428)
X-Git-Url: http://these/git/%7B%60%24%7BghostArchiveUrl%7D/%7BimageSrc%7D?a=commitdiff_plain;h=bc658a80a442eb723cd44e425d61236f789bf4e4;p=lemmy-ui.git

Fix mobile navbar bug (#1428)

Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
---

diff --git a/src/shared/components/app/navbar.tsx b/src/shared/components/app/navbar.tsx
index 0163f60..5fa7580 100644
--- a/src/shared/components/app/navbar.tsx
+++ b/src/shared/components/app/navbar.tsx
@@ -35,7 +35,11 @@ interface NavbarState {
 }
 
 function handleCollapseClick(i: Navbar) {
-  if (i.collapseButtonRef.current?.ariaExpanded === "true") {
+  if (
+    i.collapseButtonRef.current?.attributes &&
+    i.collapseButtonRef.current?.attributes.getNamedItem("aria-expanded")
+      ?.value === "true"
+  ) {
     i.collapseButtonRef.current?.click();
   }
 }
@@ -76,12 +80,8 @@ export class Navbar extends Component<NavbarProps, NavbarState> {
     document.removeEventListener("mouseup", this.handleOutsideMenuClick);
   }
 
+  // TODO class active corresponding to current pages
   render() {
-    return this.navbar();
-  }
-
-  // TODO class active corresponding to current page
-  navbar() {
     const siteView = this.props.siteRes?.site_view;
     const person = UserService.Instance.myUserInfo?.local_user_view.person;
     return (