Navbar doesn't stay expanded after clicking on a sub menu link in the navbar

I've a navbar on the left side of my webpage. This is a collapsible navbar and it expands when you hover over it. Once it expands, we can click on pin icon to pin the navbar so that it always stays expanded. After pinning, once I click on any link in the menu as part of the navbar, the navbar collapses and doesn't stay expanded. I want it to remain expanded. Please suggest a way to resolve this.