SharePoint ADA: TD to TH and role=presentation

The short of this is I am looking at all ADA for SharePoint 2010 websites: One of the issues is around tables.

If a data table has headers marked up using TD, then change these to TH. If a data table has no headers, add TH elements describing each row and/or column. If the table is only used for layout add role='presentation' to the TABLE element.

How would I fix this globally on publishing site? Could I force this via jQuery or ?

Any input would be great!

KZ

August 31st, 2015 5:07pm

Hi,

According to your description, my understanding is that you want to add table header th tag to table and add add presentation role to the table.

If you want to want to do globally on publishing site, we can use Jquery to add table header to the table and if the header is created by td, we can firstly delete the firstly table row then add <th> tag to the table.

Here are some detailed articles for your reference:

How to add header for dynamic table

Table Manipulation using jQuery - Performance Tips and Best Practices

HTML5 and Tables for Layout

Thanks

Best Regards

Free Windows Admin Tool Kit Click here and download it now
September 8th, 2015 1:22am

Thanks! I will review this. I am looking at trying to "fix" the accessibility issues that SP2010 has (many of them really) when using Bootstrap 3x. This is just one of the many issues. Am looking at this now!
September 9th, 2015 12:28pm

So this did the trick (still working on it)  

$('tr:first-child').children('td').replaceWith(function(i, html) {
return '<th>' + html + '</th>';
  });

Thanks!!

KZ

  • Marked as answer by KZull Thursday, September 10, 2015 5:37 PM
  • Unmarked as answer by KZull 13 hours 34 minutes ago
Free Windows Admin Tool Kit Click here and download it now
September 10th, 2015 5:37pm

So this did the trick (still working on it)  

$('tr:first-child').children('td').replaceWith(function(i, html) {
return '<th>' + html + '</th>';
  });

Thanks!!

KZ

  • Marked as answer by KZull Thursday, September 10, 2015 5:37 PM
  • Unmarked as answer by KZull Friday, September 11, 2015 6:03 PM
September 10th, 2015 5:37pm

Ok - so still working on this - it messed with the editing experience - in particular the web part panel :/ so need to define this a bit more
Free Windows Admin Tool Kit Click here and download it now
September 11th, 2015 2:04pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics