The exact solution depends on the specific theme and template used.
Your list probably opens with some class (this is where knowing the exact template is key). Lets say it adds the class "open" when you click on something to expand.
Then lets assume that the current element, the one selected gets a "selected" class added.
If this where the case, then you could find the selected element.
Then you want to "roll-up" to the parent and add the class of open.
Again, the assumption here is that all the main/parent elements have a class of "main"
You would do this on every page load.
Another approach is to just render your list with a PL/SQL Region, and do something similar as above, but that sounds like a lot of work.