Fixes nav drawer generating two different cookies for open state#513
Fixes nav drawer generating two different cookies for open state#513ScarletKuro merged 1 commit intoMudBlazor:devfrom
Conversation
|
Anu6is
left a comment
There was a problem hiding this comment.
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
|
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. |



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.