Expand first item in Nested Accordion

I am considering implementing a nested accordion menu inside a hamburger menu, and want the first item to be open so to make people a little more conscious that you can expand the submenu. Here is a sample that I like, but of course I want to customize it... https://codyhouse.co/demo/multi-level-accordion-menu/index.html In that sample, I would want the page to load and "Group 1" to be expanded by default. Prefer to do all of this just using HTML and CSS
No description
35 Replies
ἔρως
ἔρως2w ago
considering that that's using the input + label hack, you can just have the first input be checked
McMarty
McMartyOP2w ago
I want to make it accessible. Someone showed me a way a few months ago, but I forget the specifics. I am just asking now more from a conceptual standpoint than getting into actual code. Just trying to figure out a design that works for me. As I recall, the checkbox approach is NOT accessible, but there is a way to do it using pure HTML/CSS that is accessible and which works better
ἔρως
ἔρως2w ago
do you have anything more than an idea?
McMarty
McMartyOP2w ago
No, just working on design right now. (Sorry I didn't keep the code sample someone shared with me - I hope I saved it somewhere?!)
ἔρως
ἔρως2w ago
that's not the problem the problem is that you're asking for a solution for a concept
McMarty
McMartyOP2w ago
I have a super complicated website, and I am racking my brain trying to come up with something that workls on mobile and which looks good, is accessible, and which can ideally be coded using pure HTML/CSS with maybe a spinkle of JS I asking conceptually if what I described is hard to do - not how you'd do it per se
ἔρως
ἔρως2w ago
conceptually, probably easy
McMarty
McMartyOP2w ago
So I can assume that I can do it?
ἔρως
ἔρως2w ago
yeah, in most cases, yes
McMarty
McMartyOP2w ago
Here is some more context...
McMarty
McMartyOP2w ago
On my hamburger menu I want to first have tabs like the WSJ uses...
No description
McMarty
McMartyOP2w ago
But where you see th Sections above, I want to put in that green nested accordion The first tab would be: "By Subject" The second tab would be: "By Content Type" Made up example... Let's say the first tab has... - Business - Economy - Tech - Politiics For the second tab, I will have the same section names - the confusing part - so I want to expand the first item (e.g. "Business") to show people that the sub-items are different. For example... Business - Written - Audio - Video Follow me? So that is why I am asking conceptually if I should be able to easily expand whatever my first parent item is in the nested accordion to help cue users to the difference without making them expand things, or get confused and think it is a duplicate to the first tab Make sense?
ἔρως
ἔρως2w ago
conceptually, yes that's the thing: conceptually
McMarty
McMartyOP2w ago
If I use HTML/CSS, is there some first-child thingy that you can style to expand the first item? (My apologies for not having the accessible code sample someone shared last year. I probably lost some good code - but Discord is so hard to maintain concversations...)
ἔρως
ἔρως2w ago
depending on the implementation, you shouldn't need to use first-child
McMarty
McMartyOP2w ago
How would I do it then?
ἔρως
ἔρως2w ago
that's impossible to answer
McMarty
McMartyOP2w ago
Btw, I am pretty sure somewhere on my hrd-drive I have a text file with notes and a URL to the code that avoids using the checkbox approach and which is 100% accessible. Not ready for that yet, but when the time comes, I think I can find it. Not sure if you need that in order to answer if what I want is technically doable?
ἔρως
ἔρως2w ago
it would need to be more than a concept even a demo would be enough a demo of what you have in your head
McMarty
McMartyOP2w ago
Well I posted a screen shot of what I want That isn't enough? You need a working demo?
ἔρως
ἔρως2w ago
i just need something more than a concept for the example of the link you sent on top, it's just a matter of adding checked to the first input
McMarty
McMartyOP2w ago
Okay, I will have to look for it. But I think I can find it eventually. And I will take away for now that I can likely do what I want.
ἔρως
ἔρως2w ago
it's very likely you can do what you want
McMarty
McMartyOP2w ago
Yeah, but I was told that is a bad, inaccessible code example - even though I like how it looks and works. A few months ago someone in Discord showed me a way to ge tht e look I want and be more user friendly. I just have to find my notes and the code So I will remain encouraged then And I will follow up here when I can get you some code and or a working online example
ἔρως
ἔρως2w ago
it is inaccessible that would be amazing
McMarty
McMartyOP2w ago
It's a start! Thank you
ἔρως
ἔρως2w ago
you're welcome
McMarty
McMartyOP2w ago
(I was good and posted another question in this forum!). 😉
ἔρως
ἔρως2w ago
i can't be more precise right now, without something "tangible" as you should imagine having this chat in #chit-chat while others talk at the same time
McMarty
McMartyOP2w ago
I will get back to you as soon as I can - still organizing my hard-drive and juggling 20 things at once
ἔρως
ἔρως2w ago
do what you need, take your time
McMarty
McMartyOP2w ago
As mentioned, every server is differnet and I have a hard time remembering where people want me to post. I will try harder to remember
ἔρως
ἔρως2w ago
it's fine, don't worry
McMarty
McMartyOP2w ago
If you have time, swing by front-end > "Replace Hamburger Menu with a Menu Page?" 🙂
13eck
13eck2w ago
This channel is for code-specific questions. If you want to just discuss ways of doing something, please use #discussions

Did you find this page helpful?