Fantastic!
Here is the script and style reference that works for me. The length of the menu tree can vary dynamically. If you prefer not to manually create a Map transform binding for each item, this solution could be quite helpful.
MenuTree>onItemClicked
def runAction(self, event):
def clear_Style(items):
# remove the style
for node in items:
node["style"] = {"classes":""}
if len(node["items"]) > 0:
clear_Style(node["items"])
items = self.props.items
path = event.path
clear_Style(items)
for node in path[:-1]:
items = items[node]["items"]
items[path[-1]]["style"] = {"classes":"menu_selected"}
stylesheet.css
.psc-menu_selected{
background-color: var(--info);
}