How to open custom menu for current page like as in Navigation Pane?

Hello, when i open page from navigation pane it’s change state and open three in panel like that

How can i get same logic for my own custom menu made by menu application?
My menu don’t open list when i go to inner page.
may be i need paste some velocity in this option?
I use menu macro from example
{{menu id=“…” type=“…”}}
{{documentTree root=“document:xwiki:Prod.WebHome” compact=“true” hierarchyMode=“parentchild”/}}

maybe it will help someone. I used this code to solve my problem

{{documentTree root=“document:xwiki:NAME_OF_PAGE.WebHome” compact=“true” openTo=“document:$doc.documentReference”/}}