I can not delete an item from the side menu

Hello, it’s a quick problem, what happens is that I’m trying to delete an element from the side menu with the block:
image

And when I execute the block the element is not deleted from the side menu, I tried a button, even right click and “do it” but that element is not deleted.

Here I leave the complete block, what I want is that when I select an element from the laterial menu, I want to move a submenu with new item.

image

Don’t delete it from the menu item click.

You will need to find another place in your code to delete it, when the menu is not open.