domestic-ui GitHub

Action bar

A long form whose Save and Cancel buttons stay in a sticky bar at the bottom of the window, with scroll margins so the bar never hides the focused field (WCAG 2.4.11).

Where the action bar is used The action bar is a sticky strip at the bottom of the window under a long form, holding its Save and Cancel buttons.

Live example

Edit customer

<form class="stack" aria-labelledby="edit-form-title">
  <h3 id="edit-form-title">Analytical Engines Ltd.</h3>
    <div data-field>
      <label for="ab-company">Company name</label>
      <input type="text" id="ab-company" name="company" value="Analytical Engines Ltd." autocomplete="organization">
    </div>
    <div data-field>
      <label for="ab-number">Customer number</label>
      <input type="text" id="ab-number" name="number" value="C-118" readonly>
    </div>
    <div data-field>
      <label for="ab-vat">VAT number</label>
      <input type="text" id="ab-vat" name="vat" value="GB 123 4567 89" autocomplete="off">
    </div>
    <div data-field>
      <label for="ab-contact">Contact person</label>
      <input type="text" id="ab-contact" name="contact" value="Ada Lovelace" autocomplete="name">
    </div>
    <div data-field>
      <label for="ab-email">Email</label>
      <input type="email" id="ab-email" name="email" value="ada@analytical-engines.example" autocomplete="email">
    </div>
    <div data-field>
      <label for="ab-phone">Phone</label>
      <input type="tel" id="ab-phone" name="phone" value="+44 20 7946 0018" autocomplete="tel">
    </div>
    <div data-field>
      <label for="ab-street">Street and number</label>
      <input type="text" id="ab-street" name="street" value="12 St James's Square" autocomplete="address-line1">
    </div>
    <div data-field>
      <label for="ab-postcode">Postal code</label>
      <input type="text" id="ab-postcode" name="postcode" value="SW1Y 4JH" autocomplete="postal-code">
    </div>
    <div data-field>
      <label for="ab-city">City</label>
      <input type="text" id="ab-city" name="city" value="London" autocomplete="address-level2">
    </div>
    <div data-field>
      <label for="ab-country">Country</label>
      <select id="ab-country" name="country" autocomplete="country">
        <option value="DE">Germany</option>
        <option value="NL">Netherlands</option>
        <option value="GB" selected>United Kingdom</option>
      </select>
    </div>
    <div data-field>
      <label for="ab-terms">Payment terms</label>
      <select id="ab-terms" name="terms">
        <option>14 days net</option>
        <option selected>30 days net</option>
        <option>60 days net</option>
      </select>
    </div>
    <div data-field>
      <label for="ab-limit">Credit limit (€)</label>
      <input type="number" id="ab-limit" name="limit" value="5000" min="0" step="100">
    </div>
    <div data-field>
      <label for="ab-notes">Internal notes</label>
      <textarea id="ab-notes" name="notes">Prefers delivery before noon.</textarea>
    </div>
    <div data-field>
      <label for="ab-reference">Purchase order reference</label>
      <input type="text" id="ab-reference" name="reference" value="PO-AE-2025-07" autocomplete="off">
    </div>
  <footer data-action-bar>
    <button type="submit">Save customer</button>
    <a href="./" data-button="secondary">Cancel</a>
  </footer>
</form>

API

Attribute or valueWhereEffect
data-action-bara <footer> (or <div>) that is the last child of a <form>holds that form's buttons

The Save and Cancel buttons of a long form, kept in view: a bar at the end of the <form> that sticks to the bottom of the scroll area while the form scrolls, and comes to rest after the last field when the end of the form is reached. Built with position: sticky, so it never leaves its form and needs no script. The buttons wrap onto a second row on narrow screens.

Our choice: the bar is the last child of the <form> it submits, so its submit button needs no form="…" attribute, and the sticky bar stops at the form's end instead of covering what follows.

Elevation

--dui-elevation-overlay and its surface (level 2), whose 1px ring draws the edge so it reads as above the fields it covers; the transparent border is what forced colors mode paints.

Keyboard

KeyAction
Tabmoves from the last field to the bar's buttons; a focused field is scrolled clear of the bar
Enterin a text field, submits the form (native)

Accessibility

  • Buttons sit at the inline end in source order, never reversed with CSS, so the Tab order follows the visual order (WCAG 2.4.3); put the primary action (type="submit") first.
  • A sticky bar must not hide the field that has focus (WCAG 2.4.11 Focus Not Obscured (Minimum)).
  • Every ancestor of a form with an action bar gets a scroll-padding at its block end as tall as a bar with two rows of buttons, so when Tab moves to a field under the bar, the browser scrolls it clear above the bar (WCAG technique C43).
  • Because it is set on every ancestor, it works in whichever one scrolls: the page or a pane that scrolls on its own.
  • Buttons keep their target size (36px, 32px compact, 44px on touch; WCAG 2.5.8).
  • The bar is a <footer> of the form, which is not a landmark inside a form.
  • Give the bar no role; its buttons say what they do ("Save customer").
  • The reserved space covers two rows of buttons: keep the bar to two or three short labels, so it never wraps to a third row at 320px; put further actions in a menu button.

Specifications

See also

How other systems do it

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

  • Apple Human Interface Guidelines: No equivalent
  • Material Design 3: No equivalent
  • Vercel Geist: No equivalent

Search