On a minimal D7 install with the the forum module enabled, the default list of forums presents something like this:
| Forum | Topics | Posts | Last post |
|---|---|---|---|
|
2 1 new |
4 |
By testuser 30 min 21 sec ago |
|
|
2 1 new |
4 |
By testuser 30 min 21 sec ago |
The "1 new" link creates an accessibility issue because its link text doesn't provide context as to where the link will take a user (ie. it's not clear if clicking "1 new" will take the user to the "General Discussion" or the "Example" forum). This would seem to violate WCAG 2.0 2.4.4 criterion:
The purpose of each link can be determined from the link text alone or from the link text together with its programmatically determined link context, except where the purpose of the link would be ambiguous to users in general. (Level A)
Some suggested options for resolving this issue:
- Changing the link text to read "1 new reply in General Discussion" ("in General Discussion" could be hidden text using .element-invisible)
- Making the first cell in the row a header row with a scope="row" (See the related WCAG technique on identifying the purpose of a link in a table cell)
- Remove this functionality
This issue applies to the replies column in the topics view as well, which also reads "1 new". (I figured it didn't need to be logged as a separate bug).
| Comment | File | Size | Author |
|---|---|---|---|
| #33 | forum-1060700-better-link-text-test-only.patch | 1.12 KB | eiriksm |
| #31 | forum-1060700-better-link-text.patch | 2.93 KB | eiriksm |
| #28 | forum-1060700-better-link-text.patch | 2.53 KB | eiriksm |
| #26 | forum-1060700-better-link-text.patch | 1.81 KB | eiriksm |
| #24 | forum-1060700-better-link-text.patch | 1.9 KB | eiriksm |
Comments
Comment #1
Everett Zufelt commentedThanks for catching and posting this.
If I understand correctly, you are saying that since each link has the anchor text "1 new" that it is ambiguous. I would agree in part.
I would argue that based on the location in the table that the link purpose is programmatically determinable, but we should make sure that the first column is marked as a header, using whichever technique is best supported by AT.
I also question whether the links aren't equally ambiguous to all, but there is not reason that this should prevent us from improving accessibility where we can.
Setting to 7.x-dev, as this is a markup change that likely can be patched into a 7.x release.
Comment #2
Everett Zufelt commentedTagging
Comment #3
daniel.nitsche commentedGreat, thanks!
H79: Identifying the purpose of a link using link text combined with its enclosing table cell and associated table headings, which I linked to in the original, report gives a good example of where this sort of text (1 new) would be ok, but you can see they use table headers with scope attributes, while the current implementation does not.
Ambiguous to users in general is somewhat subjective:
but I don't think it applies in this case because there is a strong visual link between "1 new" and the topic name. It's the strong semantic link that's missing.
Comment #4
Everett Zufelt commented@Daniel
Thanks for the additional resources. One problem is that AT (screen-readers) don't actually honour the web standards contract. So, they poorly support table header information. This doesn't mean that we should not mark up the first column as a header, we're responsible for our side of the contract whether the AT vendors hold up their end of the deal or not.
So, I'm just pondering what the best method is for us to mark up that column, and then thinking that we need to be consistent with tables across Core, which will be a D8 issue for sure.
See: http://tink.co.uk/2010/08/screen-reader-support-for-html-tables/
Comment #5
mgiffordI'm interested in testing a patch for this when it comes out.
Comment #6
bowersox commentedIt sounds like we're all agreed with option #2: "Making the first cell in the row a header row with a scope='row'". I support that approach. +1.
Comment #7
mgiffordSo we need a patch. I'm also unsure if we should be applying this to D8 & then back-porting it at this stage.
Comment #8
bowersox commentedI believe we would apply this to D8 and then decide whether to back-port to D7. This patch would introduce a new t() string, something like this: 'in %forum_title'. We don't have that string translated already so we would need further clarification to decide whether this patch would be accepted into D7.
Comment #9
mgiffordToo bad we can't just translate 'in'...
Comment #10
xjm#9: Well, the concept of "in" is going to be vastly different in different languages. In some languages the equivalent word would actually have to come after the forum title, for example. In some languages there isn't an equivalent word. Etc. I think the
t()actually needs to go around the whole thing:t('%count new posts in forum %title')or such. So I don't think it can be backported. Maybe we could provide a workaround for D7.The technique in #2 in the original post sounds interesting, but I don't think it's quite as beneficial by itself as actually adding more descriptive text, which would aid all users. What about using the
#titleattribute for the link for the full explanation? Is that a correct solution?Oh, re #4: is there an issue open for core table accessibility already?
Comment #11
mgifford@xjm Agreed with the i18n. Language constructions are difficult for sure.
As far as using #title attributes, unfortunately that doesn't work for a lot of assistive technology. We could add invisible text which provides more descriptive text, or follow the guidlines here http://webaim.org/techniques/tables/data
I don't think that there is a generic issue for core table handling, but there are lots of issues related to table accessibility in core:
http://drupal.org/project/issues/search/drupal?text=table&assigned=&subm...
Comment #12
Everett Zufelt commentedIt looks like two proposed solutions.
1. Modify the link text
2. make the first col a th with scope=row
We could do both.
Can someone please tell me what function themes this table, is it just theme_table()?
Comment #13
Everett Zufelt commentedFrom documentation of theme_table()
So we could either use header, or set the scope attribute in attributes.
Comment #14
larowlanTagging
Comment #15
alexweber commentedEverett, it's actually manually done in templates:
That makes it even easier!
Comment #16
alexweber commentedAttached patches for each solution.
Comment #17
Everett Zufelt commentedCurious what the colspan is about?
Comment #18
alexweber commentedEverett, it was already there! :)
Comment #19
alexweber commentedWorking on a new patch for better link text, the old unread topic test needs to be updated because it searches for the text using xpath to determine the count.
Comment #20
mgifford#16: forum-1060700-scope-row.patch queued for re-testing.
Comment #21
heilop commented#16: forum-1060700-scope-row.patch queued for re-testing.
Comment #22
larowlanformat_plural is a wrapper to t(), you don't need to use t inside format_plural. The variable @count is available in the second string so you don't need to pass $variables['forums'][$id]->new_topics twice.
same here
Powered by Dreditor.
Comment #23
eiriksmSince this looked fairly simple, and there was no activity, I took the liberty to redo the forum-1060700-better-link-text.patch
Comment #24
eiriksmSorry, some mix up with versions here. Here is a new patch against latest 8-dev
Comment #26
eiriksmAh, sorry. That was a bit quick. Also, the test should probably be updated?
New patch attached.
Comment #28
eiriksmSorry for the spamming. That newbie just can't get it right, eh?
Anyway, here is a patch that does not fail the test (on my install anyway), since the test is now updated.
Comment #29
mgiffordPatch applies nicely. No problem about the repeats with the testing. Main thing is that you pushed through and got one that worked. It looks like it should be RTBC, but I have to get my d8 system up again. I'll check back in when I do.
Comment #30
xjmNice work @eiriksm. Do we also want to add additional test assertions to check that the forum name is there in the source?
Comment #31
eiriksmThanks for kind feedback and testing. Here is a patch that also checks for the forum name in the test. Since I am no expert at writing tests, I just added what seemed logic to me here. So the test passes, but please feel free to advice if this is not entirely correct.
Comment #32
larowlanThanks eiriksm, looks good to me.
Can you post a tests only version to verify that the new assertion fails without the new logic?
Comment #33
eiriksmSure. This is the test only. Fails for me, should fail here
Comment #35
eiriksmAs expected. Changing status back
Comment #36
larowlanLooks good to me
Comment #37
catchMakes sense, committed/pushed to 8.x.
Comment #39
superspring commentedThe patch from this issue introduced an undefined variable error, as talked about here:
https://drupal.org/node/1796292
This new issue also addresses the problem.