Support » Plugin: TablePress » Accessibility attribute for Tablepress

  • Resolved lukewarm2019

    (@lukewarm2019)


    Our site needs to comply with the WCAG 2.0 Accessibility Guidelines. We have software that helps us find issues within our site.
    Our TablePress tables have data tables that have no markup to associate data cells and header cells.
    It would be helpful if there were a “scope=’col'” attribute added the the TH tags in TablePress. However, I see no way to do that.
    Is it possible?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    Is the solution that we discussed in https://wordpress.org/support/topic/tablepress-accessibility/ a couple weeks ago not working anymore?

    Regards,
    Tobias

    Don’t think so. Here’s the code that’s in the 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 );

    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 );
    </code.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    hhm, that’s strange. The code looks correct. Could you please check if the tables on that page are actually created by the Shortcode (and not just fixed HTML code)?

    Regards,
    Tobias

    Yes, it’s definitely by shortcode.

    Here are my thoughts.
    I’m working within an environment where the server(s) are hosted within Pantheon. I have development, test, and live environments.
    TablePress is installed and activated on all three. However, the page content, tables, and short codes area no where to be found on the “dev” server.
    What I’ll do is input everything into the “dev” site and see what develops.
    I’ll let you know the outcome.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    yes, that sounds good! Thanks!
    Please also try with a minimal setup, i.e. only TablePress activated, and WordPress default theme like Twenty Sixteen, plus that extra code in the theme’s “functions.php”.

    Regards,
    Tobias

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Accessibility attribute for Tablepress’ is closed to new replies.