Restore point dialog in HTML, CSS and vanilla JS
A copy-paste Restore point dialog in plain HTML and CSS, with vanilla JavaScript: no framework, no build step, MIT-licensed.
Live preview
Source (copy-ready)
<section class="dcl-restore-point-dialog" data-dcl-scheme="light" aria-labelledby="dcl-restore-point-dialog-title"><header class="dcl-restore-point-dialog__header"><h2 id="dcl-restore-point-dialog-title">Restore point dialog</h2><p class="dcl-restore-point-dialog__muted">A grouped radio choice drives the verification action.</p></header><button type="button" class="dcl-restore-point-dialog__primary" data-open>Choose restore point</button><p class="dcl-restore-point-dialog__muted" role="status" aria-live="polite" data-result></p><dialog class="" aria-labelledby="dcl-restore-point-dialog-dialog-title"><h3 id="dcl-restore-point-dialog-dialog-title" tabindex="-1">Choose restore point</h3><p>Choose the restore point to verify before release.</p><fieldset class="dcl-restore-point-dialog__choices"><legend>Available restore points</legend><label><input type="radio" name="dcl-restore-point-dialog-restore" value="Nightly snapshot" checked data-choice> Nightly snapshot</label><label><input type="radio" name="dcl-restore-point-dialog-restore" value="Pre-migration copy" data-choice> Pre-migration copy</label><label><input type="radio" name="dcl-restore-point-dialog-restore" value="Manual archive" data-choice> Manual archive</label></fieldset><p class="dcl-restore-point-dialog__muted" data-selection>Nightly snapshot selected</p><div class="dcl-restore-point-dialog__actions"><button type="button" data-close>Cancel</button><button type="button" class="dcl-restore-point-dialog__primary" data-verify>Verify selection</button></div></dialog><script>(()=>{const root=document.currentScript.closest(".dcl-restore-point-dialog");if(!root||root.dataset.dclBound)return;root.dataset.dclBound="1";const instance=Array.from(document.getElementsByClassName("dcl-restore-point-dialog")).indexOf(root);if(instance>0){for(const el of [root,...root.querySelectorAll("*")]){for(const attr of ["id","aria-labelledby","aria-controls","aria-describedby","for","name"]){if(el.hasAttribute(attr))el.setAttribute(attr,el.getAttribute(attr)+"--"+instance)}const href=el.getAttribute("href");if(href&&href.startsWith("#"))el.setAttribute("href",href+"--"+instance)}}const preference=matchMedia("(prefers-color-scheme: dark)"),apply=()=>{root.dataset.dclScheme=preference.matches?"dark":"light"};preference.addEventListener("change",apply);apply();const q=(s)=>root.querySelector(s),qa=(s)=>Array.from(root.querySelectorAll(s));const dialog=q("dialog"),open=q("[data-open]"),close=q("[data-close]");if(close)close.addEventListener("click",()=>dialog.close());if(open)open.addEventListener("click",()=>{dialog.showModal();const h=q("h3");if(h)h.focus()});dialog.addEventListener("close",()=>{if(open)open.focus()});const note=q("[data-selection]"),verify=q("[data-verify]"),result=q("[data-result]");qa("[data-choice]").forEach(c=>c.addEventListener("change",()=>{if(note)note.textContent=c.value+" selected"}));if(verify)verify.addEventListener("click",()=>{const c=qa("[data-choice]").find(x=>x.checked);dialog.close("verified");if(result)result.textContent=(c?c.value:"Restore point")+" verification started"});})();</script></section>
<style>
.dcl-restore-point-dialog{color:#11292f;background-color:#ffffff;color-scheme:light;font:1rem/1.45 system-ui,sans-serif;padding:.8rem;border:1px solid #697f84;border-radius:.6rem;overflow-wrap:anywhere}
.dcl-restore-point-dialog *{box-sizing:border-box}.dcl-restore-point-dialog h2,.dcl-restore-point-dialog h3{line-height:1.15;margin-block:0 .6rem}.dcl-restore-point-dialog a{color:#005c62}
.dcl-restore-point-dialog button,.dcl-restore-point-dialog input,.dcl-restore-point-dialog select,.dcl-restore-point-dialog textarea,.dcl-restore-point-dialog summary{min-block-size:44px;border:1px solid #697f84;border-radius:.3rem;padding:.4rem .65rem;font:inherit;color:#11292f;background-color:#e4edef}
.dcl-restore-point-dialog input,.dcl-restore-point-dialog select,.dcl-restore-point-dialog textarea{background-color:#ffffff}.dcl-restore-point-dialog input[type="radio"],.dcl-restore-point-dialog input[type="checkbox"]{min-block-size:auto;inline-size:auto}
.dcl-restore-point-dialog button,.dcl-restore-point-dialog summary{cursor:pointer}.dcl-restore-point-dialog button:hover,.dcl-restore-point-dialog summary:hover{color:#ffffff;background-color:#00535a}
.dcl-restore-point-dialog button:focus-visible,.dcl-restore-point-dialog input:focus-visible,.dcl-restore-point-dialog select:focus-visible,.dcl-restore-point-dialog textarea:focus-visible,.dcl-restore-point-dialog summary:focus-visible,.dcl-restore-point-dialog a:focus-visible{outline:3px solid #005c62;outline-offset:2px}
.dcl-restore-point-dialog details{color:#11292f;background-color:#ffffff;border:1px solid #697f84;border-radius:.4rem;margin-block-start:.6rem}.dcl-restore-point-dialog summary{font-weight:650}
.dcl-restore-point-dialog dialog{color:#11292f;background-color:#ffffff;border:1px solid #697f84;border-radius:.6rem;max-inline-size:min(34rem,92vw);padding:1rem}
.dcl-restore-point-dialog table{border-collapse:collapse;inline-size:100%;color:#11292f;background-color:#ffffff}.dcl-restore-point-dialog th,.dcl-restore-point-dialog td{padding:.4rem;text-align:start;border-block-end:1px solid #697f84}.dcl-restore-point-dialog th{color:#11292f;background-color:#e4edef}
.dcl-restore-point-dialog [hidden]{display:none!important}.dcl-restore-point-dialog__muted{color:#405a60}.dcl-restore-point-dialog__panel{color:#405a60;background-color:#ffffff}.dcl-restore-point-dialog__well{color:#11292f;background-color:#e4edef}.dcl-restore-point-dialog__primary,.dcl-restore-point-dialog__badge{color:#ffffff;background-color:#00535a}.dcl-restore-point-dialog__badge{border-radius:999px;padding:.1rem .45rem;font-size:.8rem;font-weight:700}
.dcl-restore-point-dialog[data-dcl-scheme="dark"]{color:#eff8f9;background-color:#142f36;color-scheme:dark;border-color:#839fa5}.dcl-restore-point-dialog[data-dcl-scheme="dark"] a{color:#8fe1da}
.dcl-restore-point-dialog[data-dcl-scheme="dark"] button,.dcl-restore-point-dialog[data-dcl-scheme="dark"] input,.dcl-restore-point-dialog[data-dcl-scheme="dark"] select,.dcl-restore-point-dialog[data-dcl-scheme="dark"] textarea,.dcl-restore-point-dialog[data-dcl-scheme="dark"] summary{color:#eff8f9;background-color:#1c3c44;border-color:#839fa5}
.dcl-restore-point-dialog[data-dcl-scheme="dark"] input,.dcl-restore-point-dialog[data-dcl-scheme="dark"] select,.dcl-restore-point-dialog[data-dcl-scheme="dark"] textarea{background-color:#142f36}.dcl-restore-point-dialog[data-dcl-scheme="dark"] button:hover,.dcl-restore-point-dialog[data-dcl-scheme="dark"] summary:hover{color:#11292f;background-color:#8fe1da}
.dcl-restore-point-dialog[data-dcl-scheme="dark"] button:focus-visible,.dcl-restore-point-dialog[data-dcl-scheme="dark"] input:focus-visible,.dcl-restore-point-dialog[data-dcl-scheme="dark"] select:focus-visible,.dcl-restore-point-dialog[data-dcl-scheme="dark"] textarea:focus-visible,.dcl-restore-point-dialog[data-dcl-scheme="dark"] summary:focus-visible,.dcl-restore-point-dialog[data-dcl-scheme="dark"] a:focus-visible{outline-color:#8fe1da}
.dcl-restore-point-dialog[data-dcl-scheme="dark"] details,.dcl-restore-point-dialog[data-dcl-scheme="dark"] dialog,.dcl-restore-point-dialog[data-dcl-scheme="dark"] table{color:#eff8f9;background-color:#142f36;border-color:#839fa5}.dcl-restore-point-dialog[data-dcl-scheme="dark"] th{color:#eff8f9;background-color:#1c3c44}.dcl-restore-point-dialog[data-dcl-scheme="dark"] th,.dcl-restore-point-dialog[data-dcl-scheme="dark"] td{border-color:#839fa5}
.dcl-restore-point-dialog[data-dcl-scheme="dark"] .dcl-restore-point-dialog__muted{color:#b0c9ce}.dcl-restore-point-dialog[data-dcl-scheme="dark"] .dcl-restore-point-dialog__panel{color:#b0c9ce;background-color:#142f36}.dcl-restore-point-dialog[data-dcl-scheme="dark"] .dcl-restore-point-dialog__well{color:#eff8f9;background-color:#1c3c44}.dcl-restore-point-dialog[data-dcl-scheme="dark"] .dcl-restore-point-dialog__primary,.dcl-restore-point-dialog[data-dcl-scheme="dark"] .dcl-restore-point-dialog__badge{color:#11292f;background-color:#8fe1da}
@media (prefers-reduced-motion:reduce){.dcl-restore-point-dialog *{transition:none!important;animation:none!important}}
.dcl-restore-point-dialog fieldset{border:1px solid #697f84;border-radius:.4rem}.dcl-restore-point-dialog fieldset label{display:block;padding:.35rem 0}.dcl-restore-point-dialog__actions{display:flex;gap:.7rem;justify-content:end}</style>
When to use
Use when the choice changes a follow-up verification action and benefits from inspection before commitment. Keep the available choices few and concrete.
Avoid
Do not use radio inputs for actions that execute immediately; use buttons or links so selection and activation are not conflated.
Accessibility
Restore choices are real grouped radio inputs with a fieldset legend, visible selection text, and a separate confirmation button. Light dialog text is #11292f on #ffffff (15.19:1) or #405a60 on #ffffff (7.37:1); dark equivalents are #eff8f9 on #142f36 (13.07:1) and #b0c9ce on #142f36 (8.12:1). Native dialog provides Escape dismissal and focus is visibly outlined.
Was this useful? Send feedback.