diff --git a/js/src/dialog.js b/js/src/dialog.js index 67d0f0d..b93b2b0 100644 --- a/js/src/dialog.js +++ b/js/src/dialog.js @@ -64,6 +64,17 @@ export default class uDialog { if (!this.visible) { document.body.append(this.element); this.visible = true; + this.autofocus(); + } + } + + /** + * Set focus to element with autofocus attribute + */ + autofocus() { + const focusEl = this.element.querySelector('[autofocus]'); + if (focusEl) { + focusEl.focus(); } } diff --git a/js/src/positiondialogmodel.js b/js/src/positiondialogmodel.js index cfb985c..72d26d0 100644 --- a/js/src/positiondialogmodel.js +++ b/js/src/positiondialogmodel.js @@ -64,7 +64,7 @@ export default class PositionDialogModel extends ViewModel {

- +
diff --git a/js/src/trackdialogmodel.js b/js/src/trackdialogmodel.js index b8e41dd..601caa5 100644 --- a/js/src/trackdialogmodel.js +++ b/js/src/trackdialogmodel.js @@ -58,7 +58,7 @@ export default class TrackDialogModel extends ViewModel {
- +
diff --git a/js/src/userdialogmodel.js b/js/src/userdialogmodel.js index 47e1591..7df8a02 100644 --- a/js/src/userdialogmodel.js +++ b/js/src/userdialogmodel.js @@ -157,7 +157,7 @@ export default class UserDialogModel extends ViewModel { case 'add': observer = 'onUserAdd'; header = ` - `; + `; fields = ` @@ -174,7 +174,7 @@ export default class UserDialogModel extends ViewModel {
- +
@@ -184,7 +184,7 @@ export default class UserDialogModel extends ViewModel { case 'pass': observer = 'onPassChange'; fields = ` - +