Skip to content

Commit

Permalink
fix(components): update menu button state when navigation is toggled (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
alizedebray authored Dec 16, 2024
1 parent d7e1172 commit d97c16d
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ export class PostHeader {
? slideUp(this.mobileMenu)
: slideDown(this.mobileMenu);

// Update the state of the toggle button
const menuButton = this.host.querySelector<HTMLPostTogglebuttonElement>('post-togglebutton');
menuButton.toggled = !this.mobileMenuExtended;

// Toggle menu visibility before it slides down and after it slides back up
if (this.mobileMenuExtended) await this.mobileMenuAnimation.finished;
this.mobileMenuExtended = !this.mobileMenuExtended;
Expand Down Expand Up @@ -107,10 +111,6 @@ export class PostHeader {
if (newDevice === 'desktop' && this.mobileMenuExtended) {
this.toggleMobileMenu();
this.mobileMenuAnimation.finish(); // no animation


const menuToggler = this.host.querySelector<HTMLPostTogglebuttonElement>('post-togglebutton');
if (menuToggler) menuToggler.toggled = false;
}

// Apply only on change for doing work only when necessary
Expand Down

0 comments on commit d97c16d

Please sign in to comment.