Skip to content

Fixes nav drawer generating two different cookies for open state#513

Merged
ScarletKuro merged 1 commit intoMudBlazor:devfrom
DCWoolley:fix/nav-drawer-id
Feb 28, 2026
Merged

Fixes nav drawer generating two different cookies for open state#513
ScarletKuro merged 1 commit intoMudBlazor:devfrom
DCWoolley:fix/nav-drawer-id

Conversation

@DCWoolley
Copy link
Copy Markdown
Contributor

Previous fix I removed DrawerId from MudStaticNavDrawerToggle which caused it to generate a default cookie along side the cookie generated from the MudDrawer id. Removing the id from MudDrawer would have fixed the issue as both would then use the default cookie name, but I decided to add DrawerId back and be more explicit which also solves the problem.

@sonarqubecloud
Copy link
Copy Markdown

@ScarletKuro ScarletKuro requested a review from Anu6is February 28, 2026 15:59
Copy link
Copy Markdown
Contributor

@Anu6is Anu6is left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noted the ID removal when I looked at the last PR but didn't think it would cause an issue as specifying it was meant for if you have multiple drawers.

Just for my future knowledge does generating the 2 cause an actual problem? I do agree with syncing them and being explicit is better

@DCWoolley
Copy link
Copy Markdown
Contributor Author

It's a tricky one to notice at first. Everything seems OK until you resize the window to a smaller size and the drawer responsively closes. That's when the second 'default' cookie is created and they become out of sync. After that you can go back to a larger window size and switching from static to interactive pages can cause the drawer to close as the interactive pages looks to be using the default cookie. Also, I started to notice that sometimes on an interactive page the drawer toggle button doesn't respond on the first click. It requires another click to get the drawer to open or close.

I've noticed that on the smaller viewport sizes when the drawer is closed. If you open the menu and navigate to an interactive page the drawer auto closes again, but when navigating to static pages it doesn't, except when doing the first move from interactive to static. I couldn't figure out a solution for this but at least this is consistent as apposed to seemingly random behaviour.

@ScarletKuro ScarletKuro merged commit 06a7ec7 into MudBlazor:dev Feb 28, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants