enter works now when modal is up.

This commit is contained in:
Ozbolt Menegatti 2020-01-14 21:57:36 +01:00
parent 0dc849af66
commit f8bc2f0d22

View File

@ -1,4 +1,4 @@
from browser import window from browser import window, document
from message.message import Message, msg from message.message import Message, msg
@ -37,7 +37,14 @@ class KeyboardPress(Message):
return key == "Escape" return key == "Escape"
def update_model(self, model): def update_model(self, model):
pass key = self.get_arg(0, str)
# Enter when modal shown -> press ok button
if model.modal_shown and key == "Enter":
ok_button = document.getElementById("modal-ok")
if ok_button is not None:
# has to be called in separate thread
window.setTimeout(lambda: ok_button.click(), 10)
# a "hack" message for reseting modals # # a "hack" message for reseting modals #