Title: TablePress ADA accessibility
Last modified: October 24, 2018

---

# TablePress ADA accessibility

 *  Resolved [rachitarora](https://wordpress.org/support/users/rachitarora/)
 * (@rachitarora)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/tablepress-ada-accessibility/)
 * Hi,
    I am having the following ADA issues using the TablePress plugin on my website.
   Let me know what needs to be done to resolve that. – All layout tables do not
   contain th elements. – All complex data tables have a summary. – All data tables
   contain a caption unless the table is identified within the document. – Use colgroup
   and col elements to group columns. – Use thead to group repeated table headers,
   tfoot for repeated table footers, and tbody for other groups of rows.

Viewing 9 replies - 1 through 9 (of 9 total)

 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/tablepress-ada-accessibility/#post-10810545)
 * Hi,
 * thanks for your post, and sorry for the trouble.
 * Most of these should be fulfilled already:
    – th elements are only used in the
   table header row, which can be turned off. – A summary is not automatically added,
   but can be added e.g. with this piece of PHP code in your theme’s “functions.
   php” file:
 *     ```
       function ada_tablepress_add_summary( $table_attributes, $table, $render_options ) {
       	$table_attributes[ summary'] = $table['description'];
       	return $table_attributes;
       }
       add_filter( 'tablepress_table_tag_attributes', 'ada_tablepress_add_summary', 10, 3 );
       ```
   
 * (The table description will then be used as the summary.)
    – A caption is added
   if you turn on the “Table Description” checkbox. – colgroup and col elements 
   are not supported at the moment, but often not necessary. – TablePress uses these
   elements in the header, footer, and body.
 * Regards,
    Tobias
 *  [miskandar](https://wordpress.org/support/users/miskandar/)
 * (@miskandar)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/tablepress-ada-accessibility/#post-10830700)
 * good tip.
    Adding to the ADA issue above for TablePress, any good solution for
   following item? – Data tables that contain both row and column headers use the
   scope attribute to identify cells.
 * Thanks,
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/tablepress-ada-accessibility/#post-10830791)
 * Hi,
 * for the new question: Not directly. You would have to implement this directly
   using a filter hook, `tablepress_cell_tag_attributes` defined [here](https://github.com/TobiasBg/TablePress/blob/master/classes/class-render.php#L671).
 * Regards,
    Tobias
 *  [miskandar](https://wordpress.org/support/users/miskandar/)
 * (@miskandar)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/tablepress-ada-accessibility/#post-10835952)
 * good pointer, but is it possible if you give me more details on doing so in the
   code? appreciate your help.
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/tablepress-ada-accessibility/#post-10837226)
 * Hi,
 * no, sorry, I don’t have an example available here. You would need to write a 
   PHP function that hooks into that filter and then makes the necessary code additions.
 * Regards,
    Tobias
 *  Thread Starter [rachitarora](https://wordpress.org/support/users/rachitarora/)
 * (@rachitarora)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/tablepress-ada-accessibility/#post-10843593)
 * Hi,
    When I am using `tablepress_cell_tag_attributes` in my functions.php, I 
   am trying to add the scope=”col” to particular rows but I am unable to do so.
   Below is the code I am using
 *     ```
       function ada_tablepress_add_scope( $tag_attributes, $row_idx ) {
           if ($row_idx === 0) {
               $tag_attributes['scope'] = "col";
               return $tag_attributes;
           }
       }
       add_filter( 'tablepress_cell_tag_attributes', 'ada_tablepress_add_scope' );
       ```
   
 * I am getting the below error
 *     ```
       Warning: Missing argument 2 for ada_tablepress_add_scope(), called in /var/www/public/wp-includes/class-wp-hook.php on line 288 and defined in /var/www/public/wp-content/themes/xxxxxxxxx/functions.php on line 99
   
       Notice: Undefined variable: row_idx in /var/www/public/wp-content/themes/xxxxxxx/functions.php on line 100
   
       Fatal error: Uncaught TypeError: Argument 1 passed to TablePress_Render::_attributes_array_to_string() must be of the type array, null given, called in /var/www/public/wp-content/plugins/tablepress/classes
       ```
   
 * Please let me know how to get around the above issue.
    Thank you.
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/tablepress-ada-accessibility/#post-10845034)
 * Hi,
 * you are very close! As that filter hook uses more parameters, we need to adjust
   for that:
 *     ```
       function ada_tablepress_add_scope(  $tag_attributes, $table_id, $cell_content, $row_number, $col_number, $colspan, $rowspan ) {
           if ( $row_idx === 1 ) {
               $tag_attributes['scope'] = "col";
               return $tag_attributes;
           }
       }
       add_filter( 'tablepress_cell_tag_attributes', 'ada_tablepress_add_scope', 10, 7 );
       ```
   
 * Node the longer list of parameters and the `10, 7` parameter in the `add_filter`
   call that is necessary to tell WordPress to actually fill all parameters with
   values.
    Then (which actually looks like a mistake by me in the plugin code),
   the row and column numbers are not the index, i.e. they start with 1 instead 
   of 0.
 * Regards,
    Tobias
 *  Thread Starter [rachitarora](https://wordpress.org/support/users/rachitarora/)
 * (@rachitarora)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/tablepress-ada-accessibility/#post-10845520)
 * Hi,
    Thank you for the tip. Works like a charm 🙂 Thanks again.
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/tablepress-ada-accessibility/#post-10846188)
 * Hi,
 * no problem, you are very welcome! 🙂 Good to hear that this helped!
 * Best wishes,
    Tobias

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘TablePress ADA accessibility’ is closed to new replies.

 * ![](https://ps.w.org/tablepress/assets/icon.svg?rev=3192944)
 * [TablePress - Tables in WordPress made easy](https://wordpress.org/plugins/tablepress/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/tablepress/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/tablepress/)
 * [Active Topics](https://wordpress.org/support/plugin/tablepress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/tablepress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/tablepress/reviews/)

 * 9 replies
 * 3 participants
 * Last reply from: [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * Last activity: [7 years, 8 months ago](https://wordpress.org/support/topic/tablepress-ada-accessibility/#post-10846188)
 * Status: resolved