Active
Project:
Toolbar
Version:
1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
27 Dec 2013 at 14:13 UTC
Updated:
21 Sep 2026 at 12:08 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
jessebeach commentedI'd rather not introduce any configuration for the Navbar. But what if we vary the behavior by screen size. I'm thinking we leave the navbar open on larger screens if it was open on the previous page load and close the navbar on small screens in all cases. I agree it can be annoying to have the var open and dominating a small screen on a new page load.
What do you think?
Comment #2
mstef commentedOut of curiosity, why do you not want to introduce any configuration?
Your suggestion helps me, but I'm not sure if everyone would want that done.
That's up to you.
Comment #3
mstef commentedIs there a way to hook in and give myself this functionality? I can't seem to figure that out.
Comment #4
jessebeach commentedI tend to regard configuration as an abdication of the mandate to design. If a particular behavior is preferred, then we should just code that behavior in.
There's no way to do this without significant hacking.
Comment #5
mstef commentedHow about closing the navigation if you click outside of it, like on the page itself?
Comment #6
steveOR commentedI for one wish there was a configuration option or at least a hook to prevent the menu from being open on subsequent page loads. A quick 1-line workaround seems to be in navbar.js on line 56 make sure the activeTab variable can't find it's value in the cache...
activeTab: JSON.parse(localStorage.getItem('Drupal.navbar.activeTab___HA-HA-HA-YOU-CANT-FIND-ME'))Comment #7
he0x410 commentedAdded this JS to my theme, so it closes menu if its remain open
Comment #8
cjgriffin commentedThanks for the snippet, x610!
Comment #9
gmclelland commentedCan we just have this setting as a variable that can be overridden in settings.php? I prefer it to not remember what I had open on the previous page.
Comment #10
rodpal commentedThanks x610!
I'm using Themekey and Browsecap modules to identify mobile access to admin and loading Adminimal theme based on these conditions. I included #7 script on adminimal template.php so it will only trigger when access from a mobile browser. Hope this helps someone.
Comment #11
alfthecat commentedI would really love to have this option available as a setting. I personally think having settings is a good thing, not all people have the same preference or even not all projects require the same configuration. I think having a place to configure some of the default behaviours is better than having to install extra modules or adding js. My two cents.
Right now, regardless of screen size is quite annoying to have the navbar expand each time. Especially on slower connections.
Comment #12
hass commentedMoving to D8 first.
Comment #13
steveOR commentedMaking a patch using #6 is better than #7 because it works for all themes. Most sites use a different theme for admin pages, and those are the pages where this functionality is needed. The admin themes are usually contribs not living in your repo. A year later and I am still patching each and every site I work on so the navbar goes away on subsequent page loads. In that time I haven't met a single developer or client who likes that it stays around.
Comment #14
xjmComment #15
wim leers+1
Comment #16
Bojhan commentedThis sounds good. Lets do it
Comment #17
alfthecat commentedI´d personally also like the bar to close on large screens. It´s getting in my way there too, plus it just takes more time for the page to load when the menu is loaded again, expanded.
I´m not sure why having a config option for this is such a bad thing all of a sudden, it's not a crime is it?
Comment #18
wim leers#17: Jesse has explained why we want the toolbar to be configurationless. That's also not the scope of this issue. If you really want to discuss that, please open a new issue for that, so that we can continue moving forward here.
@Bojhan: considering @AlfTheCat's , I wonder if what we really want is not to close the vertical admin toolbar tray only after using it on a narrow screen, but after using it on any screen? Jesse said and this makes sense. But it actually doesn't make all that much sense when you've just used the toolbar. If you've used it, you're now where you want to be, so it should get out of the way.
Thoughts?
Comment #19
Bojhan commentedI think thats assuming to much, it's assuming the toolbar always gets you where you want to be. If it where a on hover interaction fly-out menu then this could work - but I dont think for Drupal's case.
Comment #20
wim leersOk, so only on narrow screens for now.
Let's keep this issue focused, and do what's agreed upon. That's a step forward. If you think this isn't going far enough yet, please open a follow-up issue.
Comment #21
alfthecat commentedOne of the reasons why I think the toolbar should have an option to always close is that for instance, if I visit a page that takes a while to load (/admin/modules for instance if a lot of modules are available) sometimes I accidentally click a menu item in the toolbar. The menu bar may not yet be visible, but you can already click menu items. So if I visit a page that takes a while to load, and happen to click on something to the left of my screen, I end up navigating away to whatever menu items turns out to be at the location I clicked.
@ Wim Leers
Thanks I will open another issue with a feature request for some configurable options, like the keep expanded/ not expanded. admin module would be a great example I think of where a few settings really help improve usability.
Comment #22
alfthecat commentedSee #2464193: Provide configuration options for toolbar menu. Please vote it up :)
Comment #23
wim leersComment #24
andrewmacpherson commentedJust a reminder that we should pay attention to the screenreader experience if we change the behaviour. We might consider announcing that the tray is closed, or tweaking some invisible 'open/close' label.
Comment #31
scottsawyerI think if this could just be closed by default for small screens, that should make everyone's lives easier now. I can't think of another mobile site where an off canvas / hide-able menu is open by default. I love the idea of configuration options, but I could see how that might be a really big job and take some time.
Comment #41
mgiffordtagging for https://www.w3.org/WAI/WCAG21/Understanding/name-role-value.html
Comment #43
dwwThis has been bothering me for a long time. The clients for a recent launch complained vigorously about the current behavior, especially on mobile, but even on wider screens.
I'm sure this won't be merged as-is, so I'm not wasting the resources with an MR and pipelines, but here's a simple patch that tells toolbar.js to always ignore the previous toolbar state and start every page load clean and closed. This is the behavior I (and these clients) expect, and it makes the site usable on mobile screens for everyone. Sharing here for posterity, and in case it helps anyone else.
To my great surprise (and delight), this patch applies cleanly (currently) to
main,11.3.x, and10.6.xbranches.Enjoy,
-Derek
Comment #44
quietone commentedThe Toolbar Module was approved for removal in #3476882: [Policy] Move Toolbar module to contrib.
This is Postponed. The status is set according to two policies. The Remove a core extension and move it to a contributed project and the Extensions approved for removal policies.
The deprecation work is in #3484850: [meta] Tasks to deprecate Toolbar module and the removal work in #3488828: [meta] Tasks to remove Toolbar module.
Comment #45
quietone commentedToolbar has moved to contrib