# Marquee

Moves a line of short phrases, links or logos along the page and loops it, between two hairlines, as a decoration.

### Known issues
On a touch screen there is no hover, so nothing stops the marquee except focusing a link. WCAG 2.2 success criterion 2.2.2 (Pause, Stop, Hide, level A) asks for a way to pause moving content that lasts more than five seconds, and the marquee has no button: it is not met there. A marquee only suits a decoration whose content is also somewhere else on the page.

A marquee should hold nothing the reader must read once and cannot return to: a price, a deadline, a warning.

### Copy the markup
A `<luz-marquee>` around two copies of the same content. The second copy is `aria-hidden="true"`, and each link in it has `tabindex="-1"`. Link `components/marquee.css` of `@luz-ds/catalog` after core.

A ticker of short phrases is a `<ul>` of `<li>`:

Marquee markup
```html
<luz-marquee>
  <ul>
    <li>Zero dependencies</li>
    <li>Native HTML first</li>
    <li>MIT, and only MIT</li>
  </ul>
  <ul aria-hidden="true">
    <li>Zero dependencies</li>
    <li>Native HTML first</li>
    <li>MIT, and only MIT</li>
  </ul>
</luz-marquee>
```

To make a row of logos move, put a `<luz-showcase>` in it, twice:

Marquee of a showcase markup
```html
<luz-marquee>
  <luz-showcase>
    <ul>
      <li><a href="https://greenleaf.example/"><svg aria-hidden="true">…</svg><span>Greenleaf</span></a></li>
      <li><a href="https://tidewater.example/"><svg aria-hidden="true">…</svg><span>Tidewater</span></a></li>
    </ul>
  </luz-showcase>
  <luz-showcase aria-hidden="true">
    <ul>
      <li><a tabindex="-1" href="https://greenleaf.example/"><svg aria-hidden="true">…</svg><span>Greenleaf</span></a></li>
      <li><a tabindex="-1" href="https://tidewater.example/"><svg aria-hidden="true">…</svg><span>Tidewater</span></a></li>
    </ul>
  </luz-showcase>
</luz-marquee>
```

### Variants and options
- `<luz-marquee>`: Around the content written twice. It moves along one line and loops, between two hairlines, and fades at both ends. A tag that no script defines: no class, no role of its own
- `<ul>`: A child that is a list is a row of short phrases, in the primary text colour, with a small decorative star between them
- `<luz-showcase>`: A child that is another tag keeps its own look: a row of links with a logo and a name, which moves as one line
- `aria-hidden="true"`: On the second child, the copy. It is hidden from assistive technology and, under reduced motion and on paper, not shown. A link in it has `tabindex="-1"`
- `--luz-marquee-duration`: On the tag, how long one loop takes. The default is 40 s, which is `calc(var(--luz-duration-lazy) * 50)`. A longer list needs more time, so it moves at the same speed

### How it works
CSS from `components/marquee.css` of `@luz-ds/catalog`. No JavaScript: `<luz-marquee>` is a tag that no script ever defines.

- The tag hides what overflows, and a mask fades both ends. Two 1 px hairlines in `--luz-divider` frame it, above and below.
- Each copy never wraps and moves left by its own width, then starts again, so the loop has no seam. Between the end of one copy and the start of the next there is the same gap as between two items.
- A copy that is a list is a row of phrases with a star after each one. The star is generated content with an empty text alternative, so a screen reader does not read it.
- The copy is not `inert`: a pointer can still click a link in it, while the keyboard and a screen reader meet each link once.
- It stops while the pointer is over it or something in it has the focus.
- Under reduced motion and on paper it does not move: the first copy is shown alone, wrapped and centred, with no fade.
- In a right-to-left page it runs the other way, from right to left.

### Without JavaScript
Nothing changes: there is no script, and the marquee is CSS.

### Keyboard and ARIA
- **Tab:** moves through the links of the first copy, in source order, each once. A ticker of phrases has nothing to focus. The links of the copy have `tabindex="-1"`.
- **Pause:** the focus on a link stops the marquee, and moving it away starts it again. Nothing else on the keyboard stops it.
- **The copy:** `aria-hidden="true"` hides it from a screen reader, which reads the first list once, as a list. Do not use `inert`, which would also stop the pointer.
- **The star:** decoration, with no text to read.
- Not tested with a screen reader.

### When to use
Use it for a decoration that adds a little life to a page: a ticker of the product’s promises, the names of the sites built with it, the sponsors of an event.

- Use it when everything it says is also elsewhere on the page.
- Write short phrases, one idea each, that mean something on their own and in any order.

### When not to use
Do not use it for anything the reader must read once and cannot return to, or for the links the page needs.

- Do not put a price, a deadline or a warning in it. For a notice that every visitor must see, use an [announcement](https://luzds.com/docs/catalog/announcement/).
- Do not use it as the navigation: for the links of the site, use [site-footer](https://luzds.com/docs/catalog/site-footer/) or the [navbar](https://luzds.com/docs/catalog/navbar/).
- If the row of logos can stay still, keep it still: a [showcase](https://luzds.com/docs/catalog/showcase/) alone is easier to read and has no motion to stop.
