Currently I'm using the following:
document.onkeyup = function (data) {
if (data.key == 'Escape') {
ClosePlayerMenu()
}
};
However I'm having two separate menus. A PlayerMenu for normal users, and a Staff menu for Staff members. Everything works but I can't use the current code twice, one to close the Player Menu and one to close the Staff menu as it makes one of the two menus no longer close. So I'm trying to make the key conditional that if PlayerMenu is open, ESC will close it, if Staff Menu is open it will close that. What would be the best approach?