# Account menu

The signed-in person's name and email, links to their account pages and a sign-out button, in a popover.

**Our choice:** A disclosure, not an ARIA menu: the items are links and one form button, so a `data-popover` holding a `<nav>` keeps Tab order and link semantics; the popover lines its other children up with the links.

_Diagram: An account menu opens from the person's name at the end of the header, with their name and email, account links and a sign-out button._

## Live example

### Account menu

```html
<button type="button" popovertarget="account" data-button="quiet">Maria Santos</button>
<div id="account" popover data-popover>
  <p>
    <strong>Maria Santos</strong><br>
    <span data-text="small muted">maria@northwind.example</span>
  </p>
  <hr>
  <nav aria-label="Account" data-nav>
    <ul>
      <li><a href="#profile">Profile</a></li>
      <li><a href="#billing">Billing</a></li>
      <li><a href="#settings">Settings</a></li>
    </ul>
  </nav>
  <hr>
  <form action="#sign-out" method="post">
    <button type="submit" data-button="quiet">Sign out</button>
  </form>
</div>
```

## Attributes

### Keyboard

See the keyboard section of the [APG Disclosure pattern](https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/).

## Accessibility

- Links that go to other pages are not a menu ([menu button](https://github.com/odonckers/domestic-ui/blob/main/menu-button.html) explains when a menu fits). Tab moves through the links and the sign-out button.
- Sign out is a form that posts, not a link, so following or prefetching a link never signs anyone out ([HTTP semantics, safe methods](https://www.rfc-editor.org/rfc/rfc9110#section-9.2.1)).
- The button's name is the person's name, so it reads as whose account this is.

## Specifications

- [APG Disclosure pattern](https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/)
- [HTML popover attribute](https://html.spec.whatwg.org/multipage/popover.html)

## See also

- [Molecules](https://domestic-ui.odonckers.dev/molecules/index.md)
- Source: [`examples/patterns/compositions.html`](https://github.com/odonckers/domestic-ui/blob/main/examples/patterns/compositions.html)

## How other systems do it

For comparison only; these are not the standard this system follows.

- [Apple Human Interface Guidelines: Menus](https://developer.apple.com/design/human-interface-guidelines/menus)
- [Material Design 3: Menus](https://m3.material.io/components/menus/overview)
- [Vercel Geist: Menu](https://vercel.com/geist/menu)
