I have an app that is using the footable plugin to allow for responsive tables. Essentially it takes columns from a table and turns them into a collapsible menu that is dynamically injected into the table as a new row when a user clicks a button to expand and then it is removed once the user collapses it again.
If you look at this example, it sets display: none
on the columns but it also appends a new tr
element that has a class of .footable-detail-row and that tr
houses the menu that displays the data (you'll have to shrink your browser window to see this functionality).
This plugin does not have any accessibility built in unfortunately. I have forked their repo and am trying to make it accessible. I currently have it toggling the aria-expanded
attributes and the span
"buttons" are now button
s in my fork.
I am stuck on how I can make this accessible because the expanded menu content is dynamically injected into the DOM and then it is removed from the DOM once the toggle button is clicked again.
Perhaps I could add an aria-label
for the buttons that says something like:
When this button is clicked it will toggle a menu that is inserted into this table as a new row immediately below this one. The new row contains additional column information. To avoid this button use a screen with a width of at least 992 pixels.
Obviously that's a gigantic label but it's descriptive as to what is happening and why. Thoughts?
If I only have a button like this: <button id="myButton" aria-expanded="false">Expand Content</button>
I normally would add a aria-controls="myCollapsibleMenu"
, however, in this instance myCollapsibleMenu
doesn't exist in the DOM.
Is there any way to make a menu like this accessible short of building out my own plugin like this that adds the menu when the script loads and doesn't remove the menu from the DOM?
I have looked into the other aria
attributes like aria-live
but is there a way to make this work with aria-live
since these menus should be associated to a specific icon? Are there any other aria
attributes I can use to make this accessible? Perhaps if I use an aria-describedby
on the inserted row it would let the user know how this row relates to it the row above it.
I can add any attribute to the menu I want after it is created. Would it be acceptable to aadd a descriptive aria-label
of what happens when a user clicks on the button?