I have a ul
that can have a varying number of li
s inside it:
<ul>
<li>content</li>
<li>content</li>
</ul>
When there are no items in the list, we would have no li
elements:
<ul>
<!-- nothing -->
</ul>
However, when this is displayed to the user, it is not clear there is even a list there. To improve UX, we would want to indicate the lack of items somehow.
To solve the UX problem, one would be inclined to create a li
that says this:
<ul>
<li>no items</li>
</ul>
However, this implies there is in fact an item, "no items", in the list. This is incorrect.
Another option would be to put a different element inside the ul
to indicate the lack of items:
<ul>
<div>no items</div>
</ul>
However, only li
s (and script + template elements) are permitted inside a ul
.
My question is: what is the recommended way (that is semantically correct) to indicate to the user that a list contains no items?
Tables have the same issue, though I suspect the solution would be similar.
` with a `` or something saying "your list is empty".
– TylerH Dec 18 '19 at 20:13