My menu links just closes the menu without taking you to the link

Yeah that pretty much sums it up. When I’ve got a 3 nested menus and if it’s on the second level and doesn’t have a child it wont link. but if it has a child it will. it seems to have something to do with the arai-expanded property as when I inspect the page and change the value it will sometimes link. but I’m not sure of the root problem here.

here is my .liquid file


    {% for link in linklists[section.settings.main_linklist].links %}
      {%- assign child_list_handle = link.title | handleize -%}
  
      {% comment %}
        Check if third-level nav exists on each parent link.
      {% endcomment %}
      {%- assign three_level_nav = false -%}
      {% if link.links != blank %}
        {% if link.levels == 2 %}
          {%- assign three_level_nav = true -%}
        {% endif %}
      {% endif %}
  
      {% if link.links != blank %}
        - {{ link.title }}
              {% include 'icon-chevron-down' %}
          
  
          

              {% if three_level_nav %}
              

                

                    {% if link.links != blank %}
                      {% for childlink in link.links %}
                        - {% comment %}
  - {% endcomment %}
                        
                                {{ childlink.title | escape }}
                                {% comment %}
                                {% if childlink.links != blank %}
                                  {% include 'icon-chevron-down' %}
                                {% endif %}
                                {% endcomment %}
                        
                        
                              {% if childlink.links != blank %}
                          

                            

                                  {% for grandchildlink in childlink.links %}
                                    - {{ grandchildlink.title | escape }}
                                
                              
                                  {% endfor %}
                            
                          

                              {% endif %}
                      
                      {% endfor %}
                    {% endif %}
                
              

  
              {% else %}
              
                  {% for childlink in link.links %}
                    - {{ childlink.title | escape }}
                    
                  
                  {% endfor %}
              
              {% endif %}
          

        

      {% else %}
        - {{ link.title }}
        
      {% endif %}
    {% endfor %}