More accessible tables output by block-admin-display-form.tpl.php

Events happening in the community are now at Drupal community events on www.drupal.org.
francesco_sardegna's picture

Tables should have summaries and captions and table headers and table cells should be marked (as you teach me) with correspondent "headers" and "id" values.

I added some simple Php functions to block-admin-display-form.tpl.php and the output seems to be complete.

<

table id="blocks" summary="Show

<?php
print t('Region');
?>
,
<?php
print t('Weight');
?>
and processes for operations on blocks">

<?php
print t('Block');
?>
">
<?php
print t('Block');
?>
<?php
print t('Region');
?>
">
<?php
print t('Region');
?>
<?php
print t('Weight');
?>
">
<?php
print t('Weight');
?>
<?php
print t('Operations');
?>
" colspan="2">
<?php
print t('Operations');
?>

<?php
print t('Block');
?>
">
<?php
print $data->block_title;
?>
<?php
print t('Region');
?>
">
<?php
print $data->region_select;
?>
<?php
print t('Weight');
?>
">
<?php
print $data->weight_select;
?>
<?php
print t('Operations');
?>
">
<?php
print $data->configure_link;
?>
<?php
print t('Operations');
?>
">
<?php
print $data->delete_link;
?>

Comments

Examples from D7 Discussions

mgifford's picture

I have been trying to get better support for caption & summaries for tables, but I'm not clear that they are widely enough adopted so that they are actually useful. See:

http://drupal.org/project/issues/search/drupal?text=table&assigned=&subm...

I've tried to add this into Views as well, as so much data is presented this way.

Now, this type of change probably shouldn't be done in the template layer. It's also a bit difficult to read in a wiki format...

The three accessibility options

francesco_sardegna's picture

According to W3c recommendations tables should have a caption to describe their nature and a summary (very important if caption is missing) to summarize their content.
Caption seems to be useful for SEO as well.
The two elements are not equivalent as caption describe the purpose of the table (what data are shown and how) while summary synthetizes their content.
Third option, the 'th' cells 'headers' related to the 'td' cells 'ids' with a unique reference for column: very easy to provide in block-admin-display-form.tpl.php that outputs only the content blocks data tables, still not solved in includes/theme.inc .
I managed to provide summary and caption, but I am still looking into
function theme_table and
function _theme_table_cell (not overridable)
to sort 'headers' and 'ids' from the database and print them.
Neither I don't know this is the way.

Not arguing about W3C

mgifford's picture

The question isn't what the W3C suggests for best practices for tables. The question is what provides practical information for people using AT.

Do people using screen readers expect to find caption & summary data for a table? Does it provide context which is otherwise not apparent to them? Does it improve the ability to understand/navigate the data?

In some instances yes, but not necessarily all instances. The link I pointed to jumps back to some of the places where I argued like you are now for implementing the W3C implementations. I'd like to see them in core, but I'd like to see them in a context where it actually improves the user experience.

First information

francesco_sardegna's picture

Caption and summary, when provided, are the the first information a screen reader gives about a table.
Caption is more or less like the table title (I consider that one <hn> heading may introduce to different tables so it can't have the same function): thanks caption non-sighted users may decide whether consider that table or not (a jump link may be a nice idea).
Summary gives a more thorough information about datas, in my opinion is comfortable to definitely decide whether to keep on the (dull) reading of table datas or not.
If caption is missing the user must understand what he is going to read (or not) by the summary, which may be not exhaustive about the purpose.
If both are missing the first information are the headers, the column names, which are insufficient I think.
I am going to ask my non-sighted correspondents about it.

Accessibility

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: