Boundless theme : 3-level nav menu action-bar

Hi,

I am using the boundless theme with three sub levels on the action bar menu (e.g. Parent - Child - Grandchild) now when I click on the parent, instead of going to hierarchy, its directly going to the grandchild for the first time whenever I click on the parent but on the second time its working. I want it to work in the hierarchical order.

Can someone help to solve it. Would really appreciate your help on this!

{% assign action_bar_main_active = true %}
{% for link in linklists[section.settings.action_bar_link_list].links %}
  {% if link.active or template.name == 'index' or template.name == 'collection' %}
    {% assign child_list_handle = link.title | handleize %}
    {% if link.links == blank and link.active %}
      {% assign action_bar_active_url = link.url %}
    {% endif %}

    {% if link.links != blank %}
      {% for childlink in link.links %}
	{% if childlink.active or template.name == 'index' or template.name == 'collection' %}
		{% assign grandchild_list_handle = childlink.title | handleize %}
	{% if childlink.active or link.active %}
		{% assign active_child_link = true %}
		{% assign active_child_link_handle = child_list_handle %}

{% comment %}
make sure we're handling duplicate links in the action bar and
sub action bar menus.
{% endcomment %}

{% if childlink.active.url == action_bar_active_url %}
	{% assign action_bar_main_active = false %}      
{% endif %}
  
{% if childlink.links != blank %}
{% for grandchildlink in childlink.links %}
	{% if  grandchildlink.active or childlink.active %}
		{% assign active_grandchild_link = true %}
		{% assign active_grandchild_link_handle = grandchild_list_handle %}
	{% endif %}
{% endfor %}
{% endif %}
  
{% endif %}
{% endif %}
      {% endfor %}
    {% endif %}
  {% endif %}
{% endfor %}

  {% comment %}
    If on index, it should be at the bottom of the hero area
  {% endcomment %}