Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
First off, this module has solved a huge problem for me, so thank you for creating it.
I'd like to contribute back by adding a small accessibility patch to add the "scope" attribute to table headers as dictated here:
http://webaim.org/techniques/tables/data#headers
Adds:
scope="col" for column headers, and
scope="row" for row headers.
Please let me know if there is a better way of doing this!
Comment | File | Size | Author |
---|---|---|---|
#3 | views_matrix-accessible-headers-2645492-3-7.patch | 3.17 KB | msharkeyiii |
scope-for-headers.patch | 1.24 KB | msharkeyiii |
Comments
Comment #2
mradcliffeThank you for the patch. I appreciate adding proper attributes to improve web accessibility!
People do a git checkout of the module, make the changes, and then do a
git diff > blah.patch
when creating patches on modules or for Drupal core. There is a page if you are interested to read more at https://www.drupal.org/patch. We do this because then the maintainer or anyone who is reviewing the patch can apply the patch to the code base with the commandcurl https://www.drupal.org/files/issues/scope-for-headers.patch | git apply
or by adding the patch url to a drush make file for instance.I have reviewed the patch, and here are some comments.
It would be better to add these to the attributes element property in the template preprocess function so it's not hard-coded in the template. This is a bit difficult to find because views_matrix has a lot of code in the template preprocess function, but around line 106 and line 180 should do the trick.
I do not think that attributes are allowed on the closing element.
So to re-iterate:
1. Move the scope attribute to the row and column header render arrays in template preprocess.
2. Revert the changes to the template.
:-)
Comment #3
msharkeyiii CreditAttribution: msharkeyiii commentedThank you for the feedback. Editing the preprocess arrays are much cleaner, yes!
I've made one additional change based on WAI example here regarding the first, empty cell:
http://www.w3.org/WAI/tutorials/tables/two-headers/#table-with-header-ce...
I've updated the template file to use a < td > instead of a < th > if the column header is empty, which is the case for the first cell, and doesn't use scope attribute.
Comment #4
msharkeyiii CreditAttribution: msharkeyiii commentedComment #6
mradcliffeThanks for the patch.