def METHOD_NAME(self, ev):
    """Called when a label with a submenu is clicked."""
    target = ev.target
    if target.nodeName == "SPAN":
        # click on a navbar item
        selected = document.select(".brython-menu-navbar-item-selected")
        if selected:
            self.hide_menus()
        for item in selected:
            item.classList.remove("brython-menu-navbar-item-selected")
        submenu = target.submenu
        target.classList.add("brython-menu-navbar-item-selected")
        submenu.style.left = f"{target.abs_left}px"
        submenu.style.top = f"{target.abs_top + target.offsetHeight}px"
        # Once an item has been selected, mouseenter on the other items
        # unfolds them
        if not selected:
            for item in document.select(".brython-menu-navbar-item"):
                item.bind("mouseenter", self.METHOD_NAME)
        # Display menu
        submenu.style.display = "block"
    else:
        target = target.closest("TR")
        # Remove other submenus
        table = target.closest("TABLE")
        self.hide_submenus(table)
        # If another item in the table was selected, unselect it
        selected = table.select(".brython-menu-submenu-row-selected")
        for row in selected:
            row.classList.remove("brython-menu-submenu-row-selected")
        # Mark target as selected
        target.classList.add("brython-menu-submenu-row-selected")
        if hasattr(target, "submenu"):
            # Set top and left of submenu and display it
            target.submenu.style.top = f"{target.abs_top}px"
            target.submenu.style.left = \
                f"{target.abs_left + target.offsetWidth}px"
            target.submenu.style.display = "block"
        if not selected:
            # Once an item has been selected, mouseenter on the other
            # items unfolds them
            for row in table.select("TR"):
                row.bind("mouseenter", self.METHOD_NAME)
    # stop propagation, otherwise "click" is triggered on document,
    # which removes all menus...
    ev.stopPropagation(