On my project, navigation is done using the menu tree, but there is also a home button on the header dock as a short cut to get back to the main page. When the user clicks the home button, they are directed back as expected, but the menu tree doesn’t update. How could I use code to set the selected item in the menu tree?
EDIT:
My menu tree has multiple levels. If I am on level 0, and hit the home button, then there is no problem. If I have drilled into the menu and am now on level 3 of the menu tree, when I hit the home button, the menu tree just stays on level 3. I need to make it go back to level 0.
Assuming you’re changing background color of active tab. You can check for page.props.path is equal to the target path of that item, if it’s equal change the color.
That isn’t the issue. I have that part figured out. The problem is that if I have navigated 2 or three levels into the menu tree, then I hit the home button, the menu tree doesn’t go back to level 0.
No. We never got it figured out. We just ended up building a custom nav menu using the tree view. We like it a lot more than the built in one even if the built in one didn't have the issue.