Hello,
I am using the navbar module and the drupal8 toolbar. I think the way its using localStorage.remoteItem instead of changing the state's of the localStorageItem can lead to some confusion.
For example :
The variable
'Drupal.toolbar.trayVerticalLocked'
starts by being null, it then gets a value of 'true' if the user has interacted with it and if the user toggles the toolbar to the top it goes back to null instead of going to false.
if for some reason there is the need to check / diff from initial state (null) to the current state (also null) you just cant.
A possible example (my current) :
I want to set the initial state of the variable to true so that the toolbar opens on the left side by default and not on top. I cant check for localStorage.getItem because I cant tell if the variable is null because its the initial state or if the its null because it was closed specifically by the user.
I think both states should be differentiated.
I can release some patch but just wanted to know some opinions, maybe I am looking at it the wrong way entirely.
Best regards
Comments
Comment #2
joaogarin CreditAttribution: joaogarin commentedComment #3
joaogarin CreditAttribution: joaogarin commentedComment #11
nod_So, hum, a little bit late but I don't think you're looking about it wrong.
If I remember it was done this way to have a more predictable behavior for the toolbar, or at least prevent a mistake where the toolbar would be stuck in the horizontal state on narrow screens.
We can always talk about this, and now we have tests so it'll be easier to change.