Fixed menu state toggling.

When two menus have the same name but a different parent, they should be
treated separately. Use the parent as an additional filter for the input
query.