mirror of
https://github.com/45Drives/cockpit-navigator.git
synced 2025-07-29 16:45:13 +02:00
allow modal to scroll and change focus on enter
This commit is contained in:
parent
1d5f09dbe2
commit
d5a8f457b2
@ -49,6 +49,7 @@ export class ModalPrompt {
|
|||||||
construct_element() {
|
construct_element() {
|
||||||
let bg = this.modal = document.createElement("div");
|
let bg = this.modal = document.createElement("div");
|
||||||
bg.classList.add("modal");
|
bg.classList.add("modal");
|
||||||
|
bg.style.overflowY = "auto";
|
||||||
let fg = document.createElement("div");
|
let fg = document.createElement("div");
|
||||||
fg.classList.add("modal-dialog");
|
fg.classList.add("modal-dialog");
|
||||||
bg.appendChild(fg);
|
bg.appendChild(fg);
|
||||||
@ -203,6 +204,14 @@ export class ModalPrompt {
|
|||||||
|
|
||||||
this.show();
|
this.show();
|
||||||
inputs[0].focus();
|
inputs[0].focus();
|
||||||
|
for (let i = 0; i < inputs.length - 1; i++) {
|
||||||
|
inputs[i].onchange = () => {
|
||||||
|
inputs[i+1].focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
inputs[inputs.length - 1].onchange = () => {
|
||||||
|
this.ok.focus();
|
||||||
|
}
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.ok.onclick = () => {
|
this.ok.onclick = () => {
|
||||||
let response = {};
|
let response = {};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user