Without name attributes

Item 1

This is a details element, with a summary inside. It has an open attribute. This causes it to be open by default when the page loads, instead of closed.

Item 2

This is just like “Item 1” above, except without the open attribute.

Item 3

This is a third item.

With name attributes on each detail

Item 1

In this column, all three items are named with the same name, using the name attribute. Which means any time a user clicks to open one item, any open item will automatically close.

Also, here the first item has the open attribute applied, so it’s open by default.

Item 2

Notice when you clicked this item, any open item automatically closed.

Item 3

Using the name attribute can make for a better user experience. Users don’t have to manually manage a lot of open items. And developers don’t have to write any JavaScript to get this affect. The browser does the work.

Take care, however, to make sure this is the best experience given your usecase. Think about users who might want or need to compare one item to another.