I try to use this component inside a dropdown in the navbar.

First issue is that closing the dropdown will close the parent one too.
Second issue is that selecting an option will add 'active' class to all of its parents (all the way up to the root of the document). Same with deselect. It seems that the cause of this behavior is the use of .parents('li') throughout the code.