def METHOD_NAME(self, *args):
    """When user clicks outside of open submenus, close them all."""
    for css in [".brython-menu-navbar-item-selected",
                ".brython-menu-submenu-row-selected"]:
        for item in document.select(css):
            item.classList.remove(css[1:])
    for div in document.select(".brython-menu-submenu"):
        if div.style.display != "none":
            div.style.display = "none"