Skip to content

Search Feitio

↵ opens the first↑↓ chooseEsc closes

Dialog

A short question in the middle of the screen, before an action with a big effect or no way back. It only closes with an answer.

On this page

Playground

Pause the 12 reminders?

You can turn them back on in Settings.

Kind
Background
HTML
<button class="feitio-button" type="button" data-open-dialog="pg-dialog">Pause reminders</button><dialog class="feitio-dialog" id="pg-dialog" aria-labelledby="pg-dialog-t" aria-describedby="pg-dialog-d"><form method="dialog"><h2 id="pg-dialog-t">Pause the 12 reminders?</h2><div id="pg-dialog-d"><p>You can turn them back on in Settings.</p></div><div class="actions"><button type="submit" class="feitio-button" data-variant="primary" value="yes">Pause</button><button type="submit" class="feitio-button" value="cancel" autofocus>Cancel</button></div></form></dialog>

When to use

When not to use

Examples

Delete the "Weekly backup" schedule?

  • It stops running from now on.
  • This cannot be undone.

Action with no way back

The action in wine, and the last line says it cannot be undone. Focus starts on Cancel.

Show code
HTML
<button type="button" class="feitio-button" data-variant="danger" data-open-dialog="apagar">Apagar</button>
<dialog class="feitio-dialog" id="apagar" aria-labelledby="apagar-t" aria-describedby="apagar-d">
  <form method="dialog">
    <h2 id="apagar-t">Apagar o agendamento "Backup semanal"?</h2>
    <ul id="apagar-d"><li>…</li><li>Não dá para desfazer.</li></ul>
    <div class="actions">
      <button type="submit" class="feitio-button" data-variant="danger" value="apagar">Apagar agendamento</button>
      <button type="submit" class="feitio-button" value="cancelar" autofocus>Cancelar</button>
    </div>
  </form>
</dialog>

Delete the 12 schedules?

None comes back.

Type to confirm

Only for what deletes a lot at once: the danger button only lights up with the right word, and focus starts in the field.

Show code
HTML
<form method="dialog" data-type-to-confirm="APAGAR">
  …
  <input class="feitio-input" id="confirmar" autocomplete="off">
  <button type="submit" class="feitio-button" data-variant="danger" disabled>Apagar 12 agendamentos</button>
</form>

Anatomy

Pause the 12 reminders?

You can turn them back on in Settings.

PauseCancel
  1. The question: the action, the thing’s name and its size.
  2. What happens, and whether there is a way back.
  3. The action: verb and object; wine when it destroys.
  4. Cancel: takes focus on open.

States

Do and don’t

Do

Delete "Backup"?

Delete scheduleCancel

The question and the button say the same thing.

Don’t

Are you sure?

YesNo

"Are you sure?" with Yes and No: it does not say what.

Accessibility

Attributes

AttributeValuesWhat for
class="feitio-dialog"on the <dialog>Lifted paper, in the middle of the screen.
data-open-dialogthe idOn the opening button.
method="dialog"on the inner formThe answers close the Dialog.
data-type-to-confirmthe wordThe danger button only lights up with it.
autofocuson CancelFocus starts on the answer that does nothing.
Top