Skip to content
Advertisement

Vuetify Navigation-drawer weird behavior with mini-variant.sync

I’m experiencing an issue with the v-navigation-drawer component in my Vuetify application. When the mini-variant.sync prop is enabled and the viewport is at a certain breakpoint (between lg and md), there is a strange padding appearing on the main part of the application. I have included my code above for reference.

I am using Vuetify version 2(have not encountered any error messages). I am expecting the v-navigation-drawer component to behave as it normally does, without the strange padding appearing on the main part of the application.

Can someone please help me understand why this issue is occurring and how I can fix it? Any insights or suggestions would be greatly appreciated. Thank you 😁

See an example of the problem here(increase your resolution by clicking on the “Full page” link!!)

JavaScript

Advertisement

Answer

EDIT-

After checking so deeply, I finally found the bug which is as follows-

The behaviour of mini-variant prop is like-

JavaScript

But, in your implementation, the value of mini-variant is always true even when expand the drawer (which should change the value to false). In fact there is a blink of false -> true when expand the drawer but at the end remains true always.

Here is the proof-

JavaScript

Now, the bug is to use mini-variant like this-

JavaScript

which will always be true because no matter you expand/shrink the drawer, mini-variant is directly depending on the breakpoint which is always true for the large device, and this is what the blink of true -> false indicated.

JavaScript

Now, when mini-variant sets false for one second, the container gets padding of 256px from the left but as there no one saved the status of mini-variant (before turing it to true), it never knows if it is expanding/shrinking so the padding never gets chance to reset to default and this is what gave you the weired padding.

Now, the solution is to use a data property which can store the status of the drawer and do not directly depend on the breakpoint and this is what a way of implemenmtation described in the documentation.

Here is the working demo-

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement