menu
elementThe <menu>
element is described in the HTML specification as a semantic alternative to <ul>
, but treated by browsers (and exposed through the accessibility tree) as no different than <ul>
. It represents an unordered list of items (which are represented by <li>
elements).
The key difference is that <ul>
primarily contains items for display, while <menu>
was intended for interactive items.
The related <menuitem>
element has been deprecated.
<menu>
<li><button>Inject Hello</button></li>
<li><button>Inject Goodbye</button></li>
<li><button>Clear</button></li>
</menu>
<div class="menu-example" aria-live="assertive">
<!-- Visible message -->
</div>
<div class="announcement" aria-live="assertive">
<!-- Message for screen readers -->
</div>