diff --git a/src/message/simple_messages.py b/src/message/simple_messages.py index c9ec7ac..9977d1b 100644 --- a/src/message/simple_messages.py +++ b/src/message/simple_messages.py @@ -1,4 +1,4 @@ -from browser import window +from browser import window, document from message.message import Message, msg @@ -37,7 +37,14 @@ class KeyboardPress(Message): return key == "Escape" 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 #