If the ingame main menu is open and esc is pressed, hide all documents
Fixes #370
Update sorting events to work with lua