add enter to submit on input type

This commit is contained in:
LenAnderson
2024-04-12 20:49:55 -04:00
parent 626c93a1ab
commit 91558ad9ea

View File

@@ -107,6 +107,13 @@ export class Popup {
// illegal argument // illegal argument
} }
this.input.addEventListener('keydown', (evt)=>{
if (evt.key != 'Enter' || evt.altKey || evt.ctrlKey || evt.shiftKey) return;
evt.preventDefault();
evt.stopPropagation();
this.completeAffirmative();
});
this.ok.addEventListener('click', ()=>this.completeAffirmative()); this.ok.addEventListener('click', ()=>this.completeAffirmative());
this.cancel.addEventListener('click', ()=>this.completeNegative()); this.cancel.addEventListener('click', ()=>this.completeNegative());
const keyListener = (evt)=>{ const keyListener = (evt)=>{