Updates to make component factory safer.
Sliding menu closes after item is clicked