WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: One list item in a list

for

From: Jukka K. Korpela
Date: Sep 19, 2014 12:17PM


2014-09-19 20:55, Rakesh P wrote:

> I was so far of the thought that a HTML list should contain more than
> 2 list items.

There is no such requirement in any HTML recommendation or public draft.

> Today while I am reading some articles to write a best practice for
> using HTML list I found that even a single item can be in list.
>
> http://www.w3.org/TR/REC-html40/struct/lists.html

The cited HTML 4.01 specification requires that at least one item be
present. HTML5 drafts remove even this restriction, probably mainly in
order to formally allow a simple element like <ul></ul> initially, to be
filled with items with client-side scripting.

> Can any one help me clarify this. My screen reader say list of one
> items even though I have a single item.

That sounds reasonable. Technically it should say "a list with one
item", but this is not a big issue.

Even though <ul><li></ul> is valid in HTML 4.01 and even <ul></ul> is
valid in HTML5, they don't make sense as such. But accessibility
recommendations do not deal with such issues; perhaps they should. The
main problem, or risk, is cognitive. Depending on the way a zero-item
list or a one-item list is rendered, it might confuse the user who
expects a real list.

I don't see an issue with a two-item list. It's somewhat marginal, but
sometimes a useful construct when you wish to clearly indicate two items
as separate alternative or consecutive items.

> Another question I have is for definition list.
> I understand we use a definition list
> where a terms should be defined such as a glosary.

That's possible, but not a necessity. And there is really no special
advantage in doing so.

> Does definition
> list holds good if I use it for FAQs or instances where I have a list
> of items having a heading as <dt> and a paragraph of content under it
> as <dd>.

The definition (no pun intended) of <dl> has always been vague,
fluctuating between "list of defined terms and their definitions" and
"list of name/value pairs". In practice, the loose definition has won.
So yes, you can use it for Questions and Answers, even though a question
is most definitely not a term and an answer is not a definition of a
term (except by accident).

I don't think there is any particular accessibility issue involved.
There would be if some user agents really took <dl> for a list of
definitions of terms and did something special based on this. But this
does not happen. In practice, <dl> is just a formatting tool.

Yucca