question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Shouldn't we suggest unordered lists (ul li) for dropdown menus?

See original GitHub issue

I’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 divs:

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:closed
  • Created 6 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
dannycolincommented, Jun 14, 2018

@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 😃.

3reactions
rafalpcommented, Feb 28, 2018

BS3 dropdown-menu example (with ul li)

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:

zrzut ekranu 2018-02-28 o 11 27 24

And obviously markup was light and semantic, but in web apps dropdowns can get quite complex:

zrzut ekranu 2018-02-28 o 11 28 09

So I would like to advice us against fixating on past approach too much.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found