Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(components): update menu button state when navigation is toggled #4305

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading