Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Since #1850164: Default state of toolbar should show menu tray in non-narrow viewports the toolbar always stays open. This is non-intuitive. If I close the toolbar, I do not expect it to be open again on the next page refresh.
Both this issue and the aforementioned one can be accomplished at the same time. The toolbar can default to open, and still remember its open/closed state.
Comment | File | Size | Author |
---|---|---|---|
#21 | drupal-toolbar_remember_open_state-2667396-21.patch | 1.16 KB | ckaotik |
#3 | 2667396-3.patch | 2.45 KB | twistor |
Comments
Comment #2
twistor CreditAttribution: twistor as a volunteer commentedComment #3
twistor CreditAttribution: twistor as a volunteer commentedThis one should actually work.
I don't really like using the tri-state variable, (null, false, string) but it works for now. It can be polished up if agreement is reached.
Comment #5
mathieuhelie CreditAttribution: mathieuhelie at Floe design + technologies commentedPatch tests correctly on my end. I see what you mean about using a 'false' state to represent the closed toolbar, it's not obvious what the behavior of the code is, or why we are saving false instead of unsetting the localstorage state. We could use a string literal such as "active-tab-none" and modify the view's render logic to check for that literal.
I will try to rework the patch along those lines, but I approve 2667396-3.patch.
Comment #6
star-szrComment #7
esod CreditAttribution: esod at Memorial Sloan Kettering Cancer Center commentedThe patch works for me. Adding testing for 8.2.x and 8.1.x
Comment #8
star-szrShould we consider adding another property to the model to store a boolean rather than complicating activeTab?
Comment #9
droplet CreditAttribution: droplet commentedOh. Seems like this issue would make my hard working doesn't work anymore and we can't fix the issue forever:
#2542050: Toolbar implementation creates super annoying re-rendering.
Unless we do this:
#2696023: Save Users' Toolbar State config to serverside
I think we should consider above 2 issues before this commit. It creates more noise and unable to revert in the future.
Comment #10
star-szrComment #11
mathieuhelie CreditAttribution: mathieuhelie at Floe design + technologies commentedI agree with #8, whether or not the bottom tray is open is a different state than what the active tab is.
Comment #13
thamasComment #14
thamasThis issue could resolve a big (UX) pain of me about Drupal 8!
While the latest patch just works for me with the latest Drupal version of this time (8.2.3) I just mark this as Needs Work because of the comments in #9 and #8.
Comment #21
ckaotikI've ported the patch from #3 to D8.9. Instead of "false" I set the empty string to illustrate "the user's choice is: none", so we don't even need to alter the variable documentation. This fixed my issue on mobile, where the vertical toolbar was always open but invisible on page load, further reducing the already limited horizontal space.
The changes probably still need to be properly built using yarn, as of Drupal core now using ES6 for JavaScript development. Setting to NR for the testbot, to be reverted to NW for #8 and #9.
Comment #22
ckaotik