better dom

Massimo Melina committed Jan 29, 2023 at 22:51 UTC 48638b523a58ca351e903d26e8ae7a68af20a459
2 files changed +9 -2
frontend/src/dialog.css
+6
@@ -81,3 +81,9 @@
81 margin-top: 2em;
82 }
83 }
84 +
85 +.dialog-prompt label {
86 + display: block;
87 + margin-bottom: .5em;
88 + margin-left: .1em;
89 +}
\ No newline at end of file
frontend/src/dialog.ts
+3 -2
@@ -27,11 +27,12 @@ export async function promptDialog(msg: string, { def, type, ...rest }:PromptOpt
27 if (def)
28 inp.value = def
29 },[])
30 - return h('div', {},
31 - h('p', {}, msg),
30 + return h('form', {},
31 + h('label', { htmlFor: 'input' }, msg),
32 h('input', {
33 ref,
34 type,
35 + name: 'input',
36 autoFocus: true,
37 onKeyDown(ev: KeyboardEvent) {
38 const { key } = ev