I have implemented a dropdown menu in my Rails app (Rails 4, Ruby 2) that utilizes Foundation 5. While the dropdown menu typically functions properly, there are instances where it fails to drop down seemingly at random. I have attempted to use both "hover" and "clickable" options, but encountered the same sporadic issues. Whenever the dropdown has failed, simply refreshing the page resolves the problem. However, this inconsistency is problematic for users and something I aim to resolve. Any suggestions on how to address this issue?
The code for the dropdown menu can be found in views/layouts/_header.html.erb
and is rendered in application.html.erb
:
<nav class="top-bar" data-topbar data-options="is_hover: false">
<ul class="title-area">
<li class="name">
<h1><%= link_to 'What Key Am I In?', root_path %></h1>
</li>
<li class="toggle-topbar">Menu</li>
</ul>
<section class="top-bar-section">
<!-- Right Nav Section -->
<ul class="right">
<li><a href="#">All Keys</a></li>
<li><%= link_to 'All Chords', chords_path %></li>
<li><%= link_to 'All Notes', notes_path %></li>
<li class="divider"></li>
<li class="has-dropdown">
<% if current_user.nil? %>
<li><%= link_to 'Sign up!', new_user_registration_path %></li>
<li><%= link_to 'Log in', new_user_session_path %></li>
<% else %>
<a href="#"><%= current_user.username %></a>
<ul class="dropdown">
<li><%= link_to 'View profile', current_user %></li>
<li><%= link_to 'Edit profile', edit_user_registration_path(current_user) %></li>
<li class="divider"></li>
<li><%= link_to 'Chords Pending Approval', chords_pending_approval_path %>
<li class="divider"></li>
<li><%= link_to "Logout", destroy_user_session_path, method: :delete %></li>
</ul>
<% end %>
</li>
</ul>
</section>
</nav>