Skip to content

Machine-translated – improvements welcome. Suggest an improvement

Save bar

Speicherleiste (save bar) is the bar at the bottom of every form for creating and editing (#370, built from building blocks since #1210). It stays visible while scrolling and shows the same everywhere: “… delete” on the left, the state in the middle (“Unsaved changes”), “Discard” and the blue main button on the right with the item in its name – all on one line.

What it is for

For every form that is saved: creating or editing an entry, in the Library and the Workbench. Whatever takes effect at once (testing, fetching, a switch that acts immediately) doesn't belong in the bar but in its place. Editors with areas have one bar for the whole editor.

Matching patterns in the pattern catalogue: C5 · Save via the save bar, C12 · Main button at the bottom, C14 · Kinds of buttons: fixed, the same everywhere, B3 · Messages say why and what to do.

How to use it

With How it works
Mouse The blue main button saves, “Discard” takes the changes back – without a confirmation, its label is clear. “… delete” on the left asks first (Confirmation). Whoever wants to leave the form with unsaved changes is asked.
Keyboard Tab reaches all buttons of the bar; Enter in a field submits the form. Esc in the form discards – with a confirmation if something would be lost. While saving, the main button keeps the focus.
Touch All buttons stand on one line and have the touch target of the button (44 × 44 px); “… delete” only shows its icon.

What it means

Layout

Place What Building block
left “… delete” (loeschen): a danger button in normal size with an icon and a confirmation; locked for a reason dashed with a padlock and ⓘ Knopf art="gefahr"
middle state or message (meldung), role="status" –
right further buttons (weitere), “Discard” (kind secondary, no icon, no confirmation), the main button (kind main, blue) Knopf, Knopf art="haupt"

Without changes, “Discard” and the main button are faded – nothing to do, no explanation (principle 6). When creating, “Discard” is called “Discard draft” and leads back to the list. While saving, the main button shows “working” with “Saving …” and keeps keyboard focus. Esc in the form discards – with a confirmation if something would be lost; the “Discard” button itself doesn't ask (its label is clear).

For the person this means: blue saves exactly what its name says (“Save number sequence”). Faded means “nothing changed yet”. The state in the middle says whether something is unsaved. “… delete” only turns red under the mouse or the focus, solid red only in the confirmation.

On a phone

On a phone (up to 600 px) everything stands on one line; “… delete” then only shows its icon (the name stays for screen readers), the state is left out. “Discard” never wraps (#1291); the main button takes the rest and only wraps between words – if not even its longest word fits next to it (such as a long subject in the narrow column on an iPad in portrait), it moves to a line of its own below.

States

State How it comes about How it looks
nothing changed draft equals the saved state “Discard” and main button faded
changed draft differs state “Unsaved changes”, both buttons active
new useEntwurf(…, { neu: true }) main button “Create …”, “Discard draft” leads back to the list
saving sendet main button “working” with “Saving …”
invalid ungueltig main button faded
delete locked for a reason loeschen.gesperrt “… delete” dashed with a padlock and ⓘ, explanation on click
read only nurLesen only “… delete” and the state

“Save bar” section of the pattern page: nothing changed, changed, delete locked for a reason, new

“Save bar” section, dark

Accessibility

The state in the middle is an area with role="status" – a new message is announced. All buttons are buttons with their aria: “… delete” opens its confirmation (aria-haspopup="dialog"), locked for a reason it stays reachable and names the reason; the main button keeps the focus while saving (aria-busy). On a phone “… delete” only shows the icon, the name stays for screen readers.

Code

import { Speicherleiste, useEntwurf } from '../bausteine';

const ent = useEntwurf(gespeichert, e, { neu, zuruecksetzen: () => setE(gespeichert), liste: '/werkbank/nummernkreise' });
<form onSubmit={…} onKeyDown={ent.tasten}>
  …
  <Speicherleiste ent={ent} gegenstand={t('…nummernkreis')} sendet={sendet}
    loeschen={!neu ? {
      text: t('…nummernkreis-loeschen'),
      rueckfrage: { titel: t('…nummernkreis-loeschen-frage'), text: t('…folgen'), ja: t('…loeschen') },
      gesperrt: k.verwendet.length > 0 && t('…wird-noch-verwendet'),
      onClick: loeschen,
    } : undefined} />
</form>
Property Meaning
ent the draft from useEntwurf (new, changed, discard, Esc)
gegenstand appears in the main button: “Save number sequence” or “Create …”
loeschen { text, rueckfrage, onClick, gesperrt?, symbol? } – the fixed place on the left; onClick only runs after “yes”
sendet, ungueltig, speicherbar main button is working, is disabled (invalid), or is active even without changes
speichern handler instead of submitting the form
formular id of the form when the bar is outside it (editors with areas)
weitere further buttons before “Discard” (e.g. “Set as default”)
meldung, haupttext message instead of the state; own label for the main button (rare, e.g. “Save folder” also for a new folder)
nurLesen only “… delete” and the state, without “Discard” and the main button – e.g. a folder without permission to edit

loeschen.rueckfrage may carry mitGrund (see Button and Confirmation); loeschen.onClick then receives the chosen reason. After saving successfully and then changing page, call loeseWache() first, otherwise the warning on leaving asks.

Existing code

The folder still has its own bar in MappeFormular.tsx (green “Save”, “Delete folder” as a link); it moves to this building block in #1211. All Workbench forms use loeschen (#1210: folder type, view, number sequence, stamp, design, mailbox, automation, workflow template, synonyms, client secret in sign-in protection); the former free place links is gone. web/src/Speicherleiste.tsx forwards to the building block so the forms keep their import.

Files and tests

  • Building block: web/src/bausteine/speicherleiste/Speicherleiste.tsx, look: Speicherleiste.module.css (basic shape .speicherleiste in web/src/stile/gemeinsam-grundformen.css), logic of the buttons: shared/src/entwurf.ts
  • Pattern page: web/src/bausteine/speicherleiste/muster.tsx
  • Tests: web/test/baustein-speicherleiste.test.ts, web/test/entwurf.test.ts