onokumus / metismenu

A collapsible jQuery menu plugin

Home Page:https://onokumus.github.io/metismenu/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Setting aria-expanded works when opening/closing but is reset when following a link

rocwrxsti opened this issue · comments

Version

v2.7.0

Description

Using Rails 5.1.2, Ruby 2.4.1, jQuery 3.2.1, and Bootstrap 3.3.7

I noticed what I believe to be odd behavior when inspecting the html of my project that is using metisMenu. Per the installation instructions step # 5, I've added aria-expanded=false to the a and following ul elements in the menu. I've observed that when opening & closing the menu, the metisMenu javascript is correctly changing the state of aria-expanded from false to true, and will continue to do so while opening/closing menus.

When I click a link in the menu, that page is rendered and metisMenu continues to work (hooray!). However, I was expecting the a and ul element of the link I just clicked to be marked as aria-expanded=true but in fact they are listed as aria-expanded=false.

Is this behavior expected, or should the plugin "remember" that those elements should be marked as true now that the link they contain was clicked and is the active page? If not, I think there may be a work-around using a Rails helper method (yet to be defined, something along the lines of aria-expanded?(link) that returns the truthiness of the link status).

Error message

No errors that I can discern