-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Accordion Menu/Drilldown] Feature request/suggestions #7770
Comments
Wondered if this had ever been discussed at any point? (during planning for F6 or after release) I really wish I had the JS skills to write a PR! This would be a massive help for usability for me atleast (and I'm sure others too as they seem to be common patterns). |
I am wondering that they dont have this feature for the drilldown/accordion menu in F6. They had in the old topbar menu since Foundation 4. This is the code from the topbar of F5: if (!$dropdown.find('.title.back').length) {
$titleLi = $('<li class="title back js-generated"><h5><a href="javascript:void(0)"></a></h5></li>');
// Copy link to subnav
if (settings.custom_back_text == true) {
$('h5>a', $titleLi).html(settings.back_text);
} else {
$('h5>a', $titleLi).html('« ' + $link.html());
}
$dropdown.prepend($titleLi);
} I agree with you this feature is very essential. I am working on a new project atm where i wanted to use F6s menu plugins for the navigation, but because this feature is missing I have to watch for another solution :( |
Hmm. Good idea. For now, you could roll your own with Toggler. |
Not a bad idea @andycochran, though I don't think it will particularly easy to do within WordPress (the context where I would be using it). I might explore this route if the Zurb team say this is a dead end though. |
I had a quick play around with the toggler plugin on Codepen and made this: http://codepen.io/brettsmason/pen/BjmOoZ Not usable, but shows what I'd love to achieve in one form or another. Unfortunately I have very little chance in writing the needed JS for a custom solution 😞 so having it as an option within the accordion menu would be a complete lifesaver. As for the drilldown menu, I managed to get the parent link to display through a bit of messing with the drilldown.js code, but again I doubt I'd be able to create something usable without guidance. |
I've having a look at the drilldown plugin (as that seems a slightly easier place to start) and have a working parentLink option. However The code isn't very good and probably all over the place! First I added parentLink as an option:
And edited the _prepareMenu function:
As I said it works, but I know its all wrong. I would love to get working correctly so I can submit a PR, then maybe look at the accordion. @zurbchris if you get a minute your advice/guidance on this would be great! 😄 |
Hi - I'd just like to add my voice to this. I suggested the same thing on the foundation forum: |
I have a UI enhancement suggestion for Drilldown. Instead of a single "back" link, why not an arrangement of small circular button links that represent menu layers? |
@paxperscientiam Have you seen an example like this? Would love to know more. |
Drilldown has been merged and should make it into the next 6.2 rc. Accordian is still outstanding. @brettsmason do you want to take a look at that one too? |
@kball The accordion menu seems a lot more complicated to make it work how I'd like (separate toggle and parent link still works) and I dont think I have the JS skills. I suppose one option, but not ideal, would be adding a similar option that I added to drilldown - prepend the parent link to the accordion submenu. Would like to hear thoughts on that though - as it adds an extra click. |
@rafibomb That is close to what I had in mind, though I was thinking of something a bit more aesthetic. I will try to put together a simple mock-up and then report back here. EDIT: Ok @rafibomb here is a (very) crude rendering of what I had in mind. For one, I think it would be clearer for the "closest" menu node name to be at the top (rather than just a back button). Image includes two versions. EDIT 2: Another problem with the Drilldown menu is that unrelated content cannot occupy the space reserved for the menu at its maximum height (less the height of the closed Drilldown menu). A possible (aesthetic) solution, if such a thing is so desired, would be to allow content to fill said space and simply have the sub menus overlap as necessary. |
Here are two Examples with link to page and fold button in one menu line: |
So I've worked out how to add a button that toggles the sub-menu and keep the parent link intact. However having difficulty working out the keyboard navigation changes needed. Can anyone offer any help with what I would need to change? Also any guidance on toggle styling - I'm thinking it should be very simple, but provide a decent sizes tap target. @gakimball If I upload this somewhere/create a PR(?) would you and the Zurb guys be able to advise on style choices/keyboard navigation? |
I've uploaded an early example here. |
@brettsmason looking awesome! |
@JeremyEnglert Thanks! I'd love to get this included I'm not sure where to go with the styling. |
I like the styling. The only other way I can see it being styled is without the border - but then it may not be clear that it is (essentially) a button. |
Adding this feature, we'll also need to keep the functionality of menu items toggling sub-menus. So there needs to be visual distinction between when the menu item is a link or a sub-menu toggle. In your example, covering up the link's arrow with a sub-menu toggle arrow makes sense if every menu item is a link. It'd be awkward to use both kinds in one menu, but both need to work. Maybe the way to style "link + sub-menu toggle" is like split buttons. Not a border all the way around, but just a vertical line between the text and arrow. And maybe the current (sans-link) sub-menu toggles should have their arrows inline with the text instead of shoved to the opposite side. That could help imply that the text triggers a dropdown instead of linking to something. You'll also need to remove the |
Thanks @andycochran and @JeremyEnglert. I'm not sure how I feel about mixing an accordion menu, some with parent links and some without (that is what you mean right?). Surely you would only enable this feature if your menu had links on all parent items? The same applies for the drilldown menu - I wouldn't enable the parentLink feature on that unless I had links on all the parents. I'm happy to discuss this further though as I would rather do what the general opinion is happy with. If we could all agree on the right way to progress this I'll crack on and try and get it finished 😄 Also thanks for pointing out the |
I was hoping to use the accordion plugin to handle a hierarchy browsing interface for an administrative backend, where each "row" was a whole series of content: title, template, status, edit button, delete button. The edit and delete buttons need to click through to their various actions, the title needs to click through to a display template and the row might need to reveal a sub-menu of child pages. I wanted the disclosure triangle to be in left-aligned, in front of the item, rather than right-aligned. Each "row" is a When I read "any
And made some CSS adjustments to absolutely position the disclosure-toggling The blank Now to see if I can get it to work with a hierarchy-savvy nestedSortable plugin to allow re-ordering by drag-n-drop...! |
Is here something going on? I would hope to see the suggested split button approach in the next release cause we really want to use the accordion menu in our project. We know that having split buttons is not the best approach for every project so giving the user the control to activate/disable this feature via config would be really nice. In my opinion the visual separation (css) doesn´t need to be part of the Foundation core. But Foundation should offer the functionality and the styling can be done by the user cause it depends on the project. For example: in my project I am using background colors for the accordion menu so it would be easy to seperate the toggle and the link visually on hover. |
@Baedda I'm still working on adding the accordion menu with split button and my aim is to get it into v6.3 (it couldn't appear any sooner as its a new feature anyway). However my priorities have had to shift a bit to help with bug fixes etc. I do have a working version with the split button approach though, I just need some help with the keyboard navigation changes to make it work fully. @Owlbertz Do you mind giving me a bit of assistance in finishing this maybe later this week if you have time? I just need some guidance on what I need to change and the best approach etc! |
@brettsmason Sure. For me end of the week (or even the weekend?) would fit best. |
@Owlbertz No problem I'll try and sort out what I need to ask you in the next few days, but there's no rush at all, whenever you get a few minutes! |
About drilldown. |
The accordion menu plugin attaches the click event to the immediate li child anchors. You can keep the parent link clickable if you wrap it in a container and add another anchor tag to open the submenu. Here is an example:
|
I'd still love to get the accordion menu with seperate submenu buttons into 6.3, but I unfortunately dont have the JS knowledge to get it over the finish line. If anyone wants to assist let me know. |
I'm still wondering if this should just be done with Toggler and live in a Building Block. |
I wrote a little patch fo the accordion menu for my own purposes which offers an option whether the submenus should be closed or the parent link should be followed. See it here here.. What do you think? |
Hmm. There's no way of knowing if the second click on the parent item will collapse its children or follow its link. There should be some type of feedback so the user know what will happen. And it would be nice to be able to follow the parent link without first uncollapsing its children. |
I agree. There is this approach which is far better. |
Here's the issue with visual cues… We basically need split buttons to work within a accordion menus. Split buttons work well because their clickable areas are visually distinct. But there are no visual cues that distinguish the clickable area of menu items. Imagine if an accordion menu was styled similar to a button group. Then it'd be easy to incorporate a split button into that group. I'm once again, pointing out the overlap in menus and button groups. 😁 |
So there has been progress with this. A branch has been added on the Zurb repo so a few other contributors can assist ing etting it ready for 6.3. See here: https://github.com/zurb/foundation-sites/tree/accordion-submenu-toggle There are 2 issues left - the keyboard navigation and a decision on how we style it. |
Here is the quick fix I found. jQuery('.menu-item-has-children > a').click(function(){
jQuery(this).unbind('click');
}); This will allow the parent link to be clickable on the second attempt. Details: It is natural response for everyone to try clicking it second time, if the first attempt is not working. Drawback: |
I love the new menu system as a whole but would love to see a few enhancements to the accordion menu/drilldown menu for menus that have sub navigation to make it possible to click the sub-menu parent links - its the one thing stopping me using both of them.
Drilldown
I would love to see an option (
data-options
?) that added the parent menu link as a link (copy?) in the sub-menu, so that it was clickable.Accordion Menu
Similar issue - it would be great if we could have an option to keep the link on the parent item and make the sub-menu toggle a separate element so that the parent link still works.
An example of what I mean is here. There's also a writeup about it here if that helps.
I'd love to discuss this further and any other ideas! Unfortunately my JS skills are very limited so I can't do much to help in that area yet 😞
The text was updated successfully, but these errors were encountered: