set focus on buttons for alert and confirm
This commit is contained in:
parent
f7753d2a0a
commit
45b20774fd
|
@ -111,6 +111,7 @@ export class ModalPrompt {
|
||||||
this.footer.innerHTML = "";
|
this.footer.innerHTML = "";
|
||||||
this.footer.appendChild(this.ok);
|
this.footer.appendChild(this.ok);
|
||||||
this.show();
|
this.show();
|
||||||
|
this.ok.focus();
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.ok.onclick = () => {
|
this.ok.onclick = () => {
|
||||||
resolve();
|
resolve();
|
||||||
|
@ -137,6 +138,10 @@ export class ModalPrompt {
|
||||||
else
|
else
|
||||||
this.yes.classList.add(primary_btn);
|
this.yes.classList.add(primary_btn);
|
||||||
this.show();
|
this.show();
|
||||||
|
if (danger)
|
||||||
|
this.no.focus();
|
||||||
|
else
|
||||||
|
this.yes.focus();
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let resolve_true = () => {
|
let resolve_true = () => {
|
||||||
resolve(true);
|
resolve(true);
|
||||||
|
|
Loading…
Reference in New Issue