MDN self-hosted library · e01.org

ARIA: menuitemcheckbox role

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

html
<div role="menuitemcheckbox"><h6>Name of my checkbox</h6></div>
html
<div role="menuitemcheckbox">
  <h6 role="presentation">Name of my checkbox</h6>
</div>
html
<div role="menuitemcheckbox">Name of my checkbox</div>
html
<li role="menuitemcheckbox" tabindex="-1" aria-checked="false">Purple</li>
css
[role="menuitemcheckbox"]::before {
  display: inline-block;
  content: "";
  color: transparent;
  width: 1em;
  text-align: center;
  outline: 1px solid;
  margin-inline-end: 2px;
  font-family: sans-serif;
}
[role="menuitemcheckbox"][aria-checked="true"]::before {
  color: inherit;
  content: "X";
}