Empty footer - Is there a way to tell data tables not to include.
Empty footer - Is there a way to tell data tables not to include.
Hi - We use data tables extensively on our website but we've never included anything in the footer. While this has worked fine for us we are now required to make our tables ada compliant and we've been flagged for our empty footer ( <tfoot></tfoot>).
I wrote a script that removes the footer after creation, which has technically made our pages compliant, but our compliance checker cannot run the script, and therefore cannot actually test the page. I was wondering if there is a way to have DataTables not create the footer, if the footer is empty.
Answers
Hi,
Is it a particular script you are running for the ADA checks? An empty
tfootdoesn't do anything, so I'm a little surprised it is giving an error.You could do:
which would always remove it. But that isn't ideal - if there is an accessibility error here, I'd prefer to resolve it in the core!
Allan
The tool we use for ADA checks is called site improve.
The reason it gives for the issue is "Some roles are designed to contain other roles. This element has this type of role, but it doesn't contain any required-owned elements." and "Roles provide information about content structure and how page elements fit together.
Some roles depend on other roles for context. For example, the role listitem can only really be meaningful in the context of a list or group. "
I'm not an expert on ADA by any means, but I believe it's because a screen reader will hit the tfoot tag and not find any data there.
I've been doing some digging, and I think it comes down to WAI-ARIA 1.1 5.2.5 Required Owned Elements.
While other accessibility tools that I've tried are not showing an issue with the empty
tfootand I'm confident that accessibility software would simply ignore it, it probably does make sense to remove the empty tag.I've committed a change for this and it is now in the nightly. It is a slightly awkward change since it needs to account for footer cells that can be added during initialisation, special handling for scrolling and if someone's source had an empty tag. The easiest option, as a result, was to just remove it after the initialisation is complete, if it is empty at that point.
Allan