refactoring js icon-based-menu hanlder