In theme_item_list(), an empty h3 element could be generated, creating an accessibility problem. Most cases of this have been removed from D8; the first attached patch removes the remaining possibilities, such as if $variables['title']
was set to FALSE. The call to isset() is removed because the variable is always set near the beginning of the function. The (string) cast ensures that types like FALSE and NULL, which cast to empty string, will not trigger the h3 element to be generated. A call to !empty() is not used because a title of zero should be possible, for example.
The second patch fixes the problem for D7, where it is a bigger issue since there is no empty string check.
Comment | File | Size | Author |
---|---|---|---|
#8 | drupal-1532512-8.patch | 783 bytes | tim.plunkett |
#4 | stop-typecasting-me.patch | 580 bytes | xjm |
#2 | tidy_list_title.patch | 869 bytes | Liam Morland |
tidy_list_title-D7.patch | 558 bytes | Liam Morland | |
tidy_list_title.patch | 869 bytes | Liam Morland | |
Comments
Comment #2
Liam MorlandD8 patch by itself.
Comment #3
Everett Zufelt CreditAttribution: Everett Zufelt commentedThis will ensure that only a non-empty string triggers the rendering of the h3.
Comment #4
xjmI think this would accomplish the same thing, without the need for the typecast?
Comment #5
xjmOops, missed the bit in the summary.
New patch inc.Actually, #2 is the least ugly way to do this, I think.Comment #6
xjmRTBC for #2 (not #4).
Comment #7
catchCommitted/pushed #2, looks like this is backportable?
Comment #8
tim.plunkettThis is only really useful in D8 in light of #256827: Various bugs in theme_item_list(), since that made the
<div class="item-list"></div>
only print when it had content.Backporting just this is fine, but its not really as important.
Comment #9
xjmHmmm. I am not sure about this being backportable... it seems like a theme change, albeit a minor one. Someone might have code written around the current behavior.
Comment #10
Everett Zufelt CreditAttribution: Everett Zufelt commentedAgreed with @xjm, and @tim.plunkett the benefit is minimal and although it is an edge case, it may break design on existing sites.