Shouldn't we suggest unordered lists (ul li) for dropdown menus?
See original GitHub issueI’ve noticed that BS4 has stopped suggesting unordered lists for dropdown menus. I’m wondering why since lists provide semantics in the HTML (think of accessibility and unstyled content). Now the code samples only use div
s:
- BS4 dropdown-menu example (with divs and classes)
- BS3 dropdown-menu example (with ul li)
Interestingly enough, the result is the same in BS4 when using lists. Is there a reason for removing list markup from the code samples? Would it make sense to put this back in?
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Navigation in Lists: To Be or Not To Be - CSS-Tricks
Every article suggest that yes you should. The vast majority of tutorials you read will use lists for navigation. The vast majority of...
Read more >Why we always use <ul> to make Navigation why not <ol>?
Using <ol> suggests that it's important the list remain in the same order. For most navigation on the web, the order of the...
Read more >How to Turn an Unordered List Into Dropdown Navigation
Go ahead & look at your webpage so far. Instead of navigation, you should see a fairly long nested unordered list at the...
Read more >aqLists: unobtrusive DHTML and the power of unordered lists
Unobtrusive DHTML, and the power of unordered lists. In recent months, we've seen people begin to take advantage of the fact that nested...
Read more >Suckerfish Dropdowns - A List Apart
“DHTML” dropdown menus have notoriously involved nasty big chunks of JavaScript with ... For this example, we will work on a simple HTML...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@rafalp the problem here seems to be that the documentation in the navbar section use
<div>
instead of<ul>
. In that case, the dropdown element is clearly a sublist.And as @bittner mentioned it, people are (sadly) copy/pasting the code verbatim.
The consequence of that is lot of site don’t respect the semantic of HTML and they also don’t respect WAI-ARIA standard. The result is that people who use assistive technologies are clearly affected by that.
So, I think that we should, at least, add a mention in the documentation pointing out that it is important to use the right HTML tag depending on here you use a dropdown menu.
Sorry, I know, I’m that annoying person pointing out that a11y is an important thing 😃.
I would like to point out for sake of balanced argument that thinking of dropdown menu as ul list of li is what has bitten us in back in BS3 times, where bootstrap’s dropdown menu meant this:
And obviously markup was light and semantic, but in web apps dropdowns can get quite complex:
So I would like to advice us against fixating on past approach too much.