Wikipedia talk:Manual of Style/Accessibility/Data tables tutorial
Unbulleted lists
At the risk of increasing the number of templates in an article, there is a space-saving template called {{Unbulleted list}} which might be useful when tables become wide. It produces the correct semantic markup for a list, which is exactly what is needed when a data cell contains a lower hierarchy of data (in this case a list). Here's an example:
Title | Album details | Peak chart positions | Sales | Certifications | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
US | AUS | AUT | FIN | NLD | NZ | NOR | SWE | SWI | UK | ||||
Bleach | 89 | 34 | 26 | 24 | — | 30 | — | — | — | 33 | 1.7 million (US) | Platinum (US) | |
Nevermind |
|
1 | 2 | 2 | 1 | 5 | 2 | 2 | 1 | 2 | 7 | 10 million(US) 26 million (worldwide) |
Diamond (US) 2× Platinum (UK) |
would become:
Title | Album details | Peak chart positions | Sales | Certifications | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
US | AUS | AUT | FIN | NLD | NZ | NOR | SWE | SWI | UK | ||||
Bleach | 89 | 34 | 26 | 24 | — | 30 | — | — | — | 33 | 1.7 million (US) | Platinum (US) | |
Nevermind |
|
1 | 2 | 2 | 1 | 5 | 2 | 2 | 1 | 2 | 7 |
|
|
This also removes some of the the superfluous column widths (if you must have them, use ems because you don't know the metrics of the client's browser font) as well as the deprecated <br /> tags that are being used to visually mimic a list. Also, style="text-align:center" is much better than setting a td to the deprecated align=center. As usual, this isn't compulsory, but it is much better practice. The extra whitespace indenting in the unbulleted lists is only there to help make the structure clearer. I don't expect every editor to cope with this sort of markup, but there's no reason why experienced editors can't improve this as they clean-up tables. --RexxS (talk) 14:47, 10 September 2010 (UTC)
- I do agree about the widths. Widths do make the table look prettier. But they should be made of
em
rather than pixels. A good practice that I forgot to apply here. Thanks for reporting. :-) - I agree about
style="text-align:center"
as well. - Now I'm not sure about this particular use of unbuletted lists. Sure the principle is good and all. But I'm not sure it's worth the effort here. In the "Album details" column it saves a little space. And in "Sales" and "Certifications" column it can sometimes indicate a list of two items. It's a lot of code for a small change. However, The Prodigy discography contains a few examples where unbuletted lists would really be useful (lists of 4 to 7 items). It needs some more thoughts (and possibly feedback from users) on my opinion.
- I do agree about the widths. Widths do make the table look prettier. But they should be made of
- Among tables, there are some far more urgent use of {{Flatlist}} (with another layout) in {{Navbox}} for example. I'd rather work on a large-scale important improvement on Navbox than a few lists here and there. Priorities, priorites. ;-) Dodoïste (talk) 04:35, 11 September 2010 (UTC)
- At a second thought, the widths are set to create a cellpadding. And ems doesn't work in the width attribute. Maybe the % would be a good solution but I'm not sure. Is there a reason why
cellpadding="5"
doesn't work withclass="wikitable"
? Cellpadding would definitely be the simplest solution. - If cellpadding are used it also solves the issue with centered text as text becomes centered by default:
align=center
becomes useless. Regards, Dodoïste (talk) 17:29, 12 September 2010 (UTC)
- At a second thought, the widths are set to create a cellpadding. And ems doesn't work in the width attribute. Maybe the % would be a good solution but I'm not sure. Is there a reason why
The element 'td' has a deprecated attribute 'width' which can only be a number or a percentage. The number is taken as a 'hint' for number of pixels, and the percentage is a 'hint' for the percentage of the table width. Neither of them is a good idea, and doesn't offer the flexibility of 'style', although having a single definition of padding is convenient. Padding is defined in the 'wikitable' class:
.wikitable th, .wikitable td { border-top-color: #aaaaaa; border-left-color: #aaaaaa; border-right-color: #aaaaaa; border-bottom-color: #aaaaaa; border-top-width: 1px; border-left-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-top-style: solid; border-left-style: solid; border-right-style: solid; border-bottom-style: solid; padding-top: 0.2em; padding-right: 0.2em; padding-bottom: 0.2em; padding-left: 0.2em; }
Since that applies to each cell, it overrides the value "inherited" from a cellpadding attribute in the table element. The best I can suggest is to either apply style="padding: 0.2em 0.8em;"
to each cell that requires padding, or to apply it to each row if you want it throughout the table. Example on a 'per-cell' basis:
Title | Album details | Peak chart positions | Sales | Certifications | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
US | AUS | AUT | FIN | NLD | NZ | NOR | SWE | SWI | UK | ||||
Bleach | 89 | 34 | 26 | 24 | — | 30 | — | — | — | 33 | 1.7 million (US) | Platinum (US) | |
Nevermind |
|
1 | 2 | 2 | 1 | 5 | 2 | 2 | 1 | 2 | 7 |
|
|
The style="text-align:center" (not align=center !!) for the number cells may still be needed if we have cells in the column with different amounts of information in them. Otherwise, for example, '1' would line up left-aligned below '89' which looks horrible. Semantically, it's now fine (look at the page source), although it does seem a lot of effort just to make it look pretty. --RexxS (talk) 19:37, 12 September 2010 (UTC)
- Thanks for the information about padding in the wikitable class.
- We'll use more code if necessary. But I would be best to choose this option only as a last resort. For the numbers of the second row a non-breakable space "& nbsp;" produces the same result. Is it better? Regards, Dodoïste (talk) 01:44, 21 September 2010 (UTC)
Avoiding more than two levels of headers
The table given as the good example could be improved by using row headers (in this case the distances). Remember, screen readers are capable of non-linear navigation, so the ability to announce the [column header][row header] before any cell value can be more effective when row headers are present, particularly on larger tables. --RexxS (talk) 15:05, 10 September 2010 (UTC)
- In theory I agree of course. In this particular case I was unsure the distance would made relevant row headers. But at a second thought – and after I saw more use cases – I think you are right. :-) Dodoïste (talk) 15:16, 10 September 2010 (UTC)
Images and color
Collapsible tables can also work without the faux header:
Country | Purpose | J | F | M | A | M | J | J | A | S | O | N | D | J | F | M | A | M | J | J | A | S | O | N | D |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Australia | x | x | x | x | x | x | x | x | x | x | x | x | |||||||||||||
Canada | x | x | x | x | x | x | x | x | x | x | x | x |
But some people may not find it as "pretty". --RexxS (talk) 16:27, 11 September 2010 (UTC)
- Interesting. So the script chooses the first header and add the "show/hide" button to it. It's a pity we can't choose the header on the far right. "Show/hide" buttons are always on the right. Usability-wise it would be better to have consistent types of contents. I wish the usability team would complete their Style Guide and ask users to comply to it. It's a good practice on Web projects. For example, we decide that link are blue and underlined on mouseover and onfocus. This behavior should never change on Wikipedia: it becomes a rule. It should be kind of similar with collapsible content: the appearance and behavior should never change.
- The best solution would be to improve the script. So that it adds the "show/hide" button to the caption instead. It's a lot of work as every table using this collapsible script should be fixed (and probably manually). Still, it's definitely something we will have to do sooner or later. I believe it would be better to gain experience with other simpler tasks. And afterwards we should make a task force for this job. Regards, Dodoïste (talk) 01:20, 12 September 2010 (UTC)
- If we could ensure every table had a caption, then it would be the perfect place for the show/hide trigger. One day, maybe ...
- Incidentally, my links are whatever colour I want, as anyone can override most global style choices in their own /[skin name here].css file. For example, I like to be able to pick out recently visited pages on my watchlist, but I'm somewhat colour-blind between the default blue link and the default for a visited link, so I set
a:visited { color: #8800C0; }
- Similarly, anyone can override default behaviour for classes, such as the class="external text" to change the style of external links only. Of course, all of this works as simply as that, only if we don't embed in-line styles in elements.
- You've made a lot of progress with giving good accessibility advice here, and all of it will also be useful for those working on the usability project – good accessibility and good usability have a habit of going together. Cheers --RexxS (talk) 04:06, 12 September 2010 (UTC)
- Yes, one can override most global choices in their own skin css file and it's a good thing. It's very important accessibility-wise. Users can select/add a style sheet directly in their browser and have it applied for all websites (or may even be able to have website-specific style sheets). The !important declaration is made especially for this purpose: it overrides the website's style sheet and inline styles.
- Still, the default appearance should not change. When users customize style sheets it's their responsibility and choice (and needs). The default appearance should be consistent nonetheless.
- "I'm somewhat colour-blind between the default blue link and the default for a visited link": as many of us average users. The usability team received a lot of complaints about it. But strangely - especially for a usability team - they did not take this feedback into account. WTF?
- Thanks. :-) I'm glad to be able to help. Yes, accessibility and usability projects should collaborate more. For example, the only solution to solve most of the contrast issue with colors in articles and templates is through usability. It's far too complicated for the average user to test color contrasts with the Color Contrast Analyzer and corresponding guidelines. It's easier to decide that "for usability reasons the colors used in Navbox should be ... (insert relevant choice here) and that rule should never change".
- Also, did you notice how I make the navigation in this Wikiproject? I used two usability recommendations that are almost never used on Wikipedia: a breadcrumb, links in the menu are organized in sub-menus that do not contain more than Seven plus or minus two items. How about we organize help pages like that? It would surely make it easier for newcomers. Regards, Dodoïste (talk) 16:01, 12 September 2010 (UTC)
Open question on missing cells
In several tables cells are not created when they should be blank. Example: Dwain Chambers. Is it an accessibility issue? Does it makes the table confusing for screen reader users? Regards, Dodoïste (talk) 20:18, 13 September 2010 (UTC)
- It's actually a UAAG issue. See Calculating the number of columns in a table:
- "... if the TABLE element contains no COLGROUP or COL elements, user agents should base the number of columns on what is required by the rows. The number of columns is equal to the number of columns required by the row with the most columns, including cells that span multiple columns. For any row that has fewer than this number of columns, the end of that row should be padded with empty cells."
- So user agents should supply empty cells (rather than failing to provide anything). Agents that conform to h-11.2.4.3 will not cause any accessibility issues specific to disabled users; but may have accessibility implications for all users of text-only agents (since they generally do not distinguish between empty and row-spanned cells). --RexxS (talk) 21:58, 13 September 2010 (UTC)
- OK, thanks RexxS. :-) Dodoïste (talk) 22:05, 15 September 2010 (UTC)
Avoiding rowspan/colspan
"Old screen readers and user agents that do not conform to UAAG do not handle rowspan / colspan efficiently. The result can be very confusing for users of these technologies." - this seems to imply that user agents that do conform to UAAG don't have problems with rowspan/colspan. Since I don't think any user agent fully conforms to UAAG, what are we saying? This opinion is reflected in Wikipedia already (Web Accessibility Initiative#User Agent Accessibility Guidelines (UAAG)). For example, I believe that Lynx conforms to UAAG as much as IE8 does, yet the rowspan vs empty cell problem demonstrably exists with Lynx. You may need to distinguish between graphical browsers and text-only browsers to give meaningful advice. --RexxS (talk) 22:42, 13 September 2010 (UTC)
- That's right, thanks for reporting this issue. I'll take it into account when I will complete this section. :-) Dodoïste (talk) 22:31, 15 September 2010 (UTC)
- I tried my best to reword this sentence. Is it okay or still confusing?
- Now this tutorial is complete. I will ask an expert to review it. :-)
- I'd like to apologize for my rudeness a few weeks ago. I did not realize you were willing to compromise on this issue. I appreciate your participation and comments. And I'm looking forward to work with you in this accessibility project. :-) Again, please accept my apologies.
- Are you okay with the content of this section? If you still disagree on something it's time to bring up the issue. Or if you would like to rephrase a few paragraphs, go ahead. :-)
- If you agree with this compromise, could you comment on Wikipedia talk:WikiProject Discographies/style#Time to update accordingly? That way we will be able to move forward, and do the same thing with other WikiProjects. :-) Kind regards, Dodoïste (talk) 01:35, 21 September 2010 (UTC)
- First of all, let me say that you've done an excellent job here, and it's much appreciated.
- Next, there's no need for you to apologise, as vigorous debate between editors usually produces better content in the end. I should however apologise for often seeming intransigent in my own views – I didn't realise I was such a villain! You come to the issue of accessibility from a background of improving it for those with disabilities. While I appreciate the rigour WCAG brings to that area, my background is in systems analysis and web design, and my instinct is to emphasise the problems for users who only have older technology, limited bandwidth, etc. They don't have an organisation like WCAG to advocate for their interests, so I often need to present my own research, rather than being able to point to a source.
- Nevertheless, I'm convinced by your arguments that "perfection is the enemy of good enough", and I'll happily go along with making improvements incrementally. It will be a long time before more than a small proportion of Wikipedians acquire anything more than a basic understanding of the issues here, and I accept that we need to "sell" these ideas slowly enough that we don't provoke rejection.
- The content is fine, by the way. Nothing on Wikipedia is a finished work, and I expect others will eventually refine and improve what you have started.
- I've commented at the Discographies style page, and I'm encouraged by the reception you've had there. Let me know when you approach other projects, and I'll do my best to help and to mobilise folks like Jack (who is clueful and has his heart in the right place). --RexxS (talk) 04:45, 21 September 2010 (UTC)
Layout for wikitable row headers
This is a reminder about the request on MediaWiki talk:Common.css to improve the default layout. It is definitely a good idea that should be adopted somehow. How do we gather consensus? Should we make a request for comment or something?
Note that I implemented this suggestion on the french Wikipedia the 22th of August, following Jack Marridev's good proposal. Regards, Dodoïste (talk) 22:04, 15 September 2010 (UTC)
Minimum font-size recommendations
I spend a lot of my time fiddling with music articles, which means I work a lot with discography tables as used in the examples here (no doubt taken from the discogs style page). This example (in both the "good" and "bad" cases) uses style="width:2em;font-size:75%"
for the column headings. The setting of 75% for the font-size is widespread among the music articles, and (or because) it closely simulates the <small></small>
that was the typical formatting before the CSS got added.
What I'd like to see addressed is what minimum font-size Wikipedia should be recommending or mandating. I think 85% is plenty small, thank you, considering that it's already 15% smaller than what the sighted user's preferred and expected font-size. The 75% used in the recommended examples here is even smaller.
I assume that the profoundly blind, using text-to-speech AT, won't care about this, but users with weak vision (and I just might be talking about visitors over about 40) would probably find accessibilty enhanced if they didn't need to squint and strain so much to tell "NL" from "NZ" apart. Is this an appropriate place to address this? Or am I better off pursuing my little crusade at Wikipedia:WikiProject Discographies/style? Thanks for the good work here. — JohnFromPinckney (talk) 11:18, 21 September 2010 (UTC)