Closed (duplicate)
Project:
Drupal core
Version:
8.0.x-dev
Component:
toolbar.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
30 Oct 2012 at 18:19 UTC
Updated:
29 Jul 2014 at 21:25 UTC
Similar to how the shortcut drawer remained open or closed according to the user's last state change operation, we want the toolbar tray to remain open or closed across page loads.
So, if a user opens the menu, navigates to Structure > Blocks and clicks on Blocks. Then when the blocks page loads, the toolbar should be opened to the menu tab, with the Blocks menu item open.

Related to #1827302: Preserve the orientation state of the toolbar for individual users across page loads.
| Comment | File | Size | Author |
|---|---|---|---|
| toolbar-open-to-blocks-page.png | 59.14 KB | jessebeach |
Comments
Comment #1
jessebeach commentedHave a look at the patch nod_ proposed for the shortcut module drawer state: #1772724: Remove most of toolbar things and put that in shortcut
Comment #2
jessebeach commentedAddressed in #1137920-220: Fix toolbar on small screen sizes and redesign toolbar for desktop.
Comment #3
benjifisherI think the right way to do this is to have an AJAX callback every time a Toolbar tray is opened or closed. Consider this use case:
I expect the Shortcut tray to be open in my new browser window. I can make this happen if the site gets an AJAX request when the Shortcut tray is opened.
I suppose you can also make it happen by saving a cookie with the Toolbar state. If you do it this way, can you reliably avoid having the page visibly redraw itself?
If we go with my suggestion of AJAX calls, then I can do the PHP side, defining a callback for
toolbar/ajax/stateor something. I am sure there are plenty of people who will have less trouble than I would with the JS side.Question: If we do it this way, how should we store the state of the toolbar? We could use a custom table, or we could use the
$_SESSIONvariable. If we use$_SESSION, thenAll the same comments apply to #1827302: Preserve the orientation state of the toolbar for individual users across page loads.
Comment #4
benjifisheroops, cross post.
Comment #5
jessebeach commentedThe way I approached this in #1137920-220: Fix toolbar on small screen sizes and redesign toolbar for desktop and the same way that tableDrag.js addresses this issue is with localStorage. It's a client-side storage mechanism that has the advantages of being super-easy to implement. Sure, it's volatile state that can't be transferred from browser to browser. I would argue that preserving the state of the open toolbar or the orientation of a tray is not mission-critical -- it can be reset very easily. Plus, localStorage won't bust cache like a $_SESSION variable will. We avoid a lot of complexity with a server side solution by trading off stability of state maintenance. In this case that seems like a fair trade. What do you think?
Comment #5.0
jessebeach commentedadded a link to #1827302