Programmatically choosing a side-menu item incorrectly nests

I want to programmatically “tap” a side-menu item (because I create it through a modal) to trigger its content to show in the main content area. It technically works, but instead of just showing the new content, it nests it under the current content. See this codepen for the behavior (click the burger menu, then the plus icon):