The attached patch to theme_fieldset() uses @aria-describedby to associate the #description with the fieldset.

Some links on adding aria-describedby and why this provides a better user experience to people using screen readers:

Contributor tasks needed
Task Novice task? Contributor instructions Complete?
Reroll the patch if it no longer applies. Instructions N/A?
Update the issue summary Novice Instructions
Add automated tests Instructions
Add steps to reproduce the issue Novice Instructions

Comments

mgifford’s picture

Looks like a useful addition. Patch applies nicely in git.

mgifford’s picture

Issue tags: -Accessibility, -aria

Status: Needs review » Needs work
Issue tags: +Accessibility, +aria

The last submitted patch, drupal_theme_fieldset_aria-describedby.patch, failed testing.

liam morland’s picture

Status: Needs work » Needs review
StatusFileSize
new1.16 KB

Reroll.

mgifford’s picture

StatusFileSize
new230.6 KB

Looks good. There's an instance in core here:
admin/config/people/accounts

Weren't as many as I had expected though. Are there other good examples you've been looking at.

Any work on fieldsets should also be aware #1168246: Freedom For Fieldsets! Long Live The DETAILS.

liam morland’s picture

Yes, I have seen the details issue. The ARIA stuff could be added to that patch or once that is committed I will write a patch like this one adding ARIA to it.

mgifford’s picture

Issue tags: -Accessibility, -aria

Status: Needs review » Needs work
Issue tags: +Accessibility, +aria

The last submitted patch, drupal_theme_fieldset_aria-describedby.patch, failed testing.

mgifford’s picture

Status: Needs work » Needs review
StatusFileSize
new1.17 KB

re-rolling to keep up with Core.

mgifford’s picture

Issue tags: +a11ySprint

Seems like a simple addition to add more semantics.

mgifford’s picture

sun’s picture

Hm. While this seems to make sense from a pure technical perspective...

...the "descriptions" that are usually output for fieldsets/details do not actually "describe" the fieldset/details. Most often, they are rather introduction texts that explain how to use the controls that are contained.

I'd understand a real description of a fieldset/details element as something like:

Contains advanced settings to customize the behavior related to foo and bar.

But that's not the case. The "descriptions" we have there are really advisory intro texts, along the lines of:

The foo and bar behavior (as configured on the Baz page) can be customized to control how this content appears for users. Use the following controls to adjust the contextual behavior, or go to the Blargh page to control the global behavior.

In short, "description" != "description". I'm not sure whether this makes sense.

liam morland’s picture

The ARIA specification gives a broad definition for aria-describedby:

A label provides the user with the essence of what the object does, whereas a description is intended to provide additional detail that some users might need.

I think the use given in this patch falls within the specification.

liam morland’s picture

Status: Needs review » Reviewed & tested by the community
webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed to 8.x. Thanks!

sun’s picture

Status: Fixed » Needs review
StatusFileSize
new1.51 KB

Attached patch fixes various problems with the committed patch.

Status: Needs review » Needs work
Issue tags: -Accessibility, -aria, -a11ySprint

The last submitted patch, drupal8.aria-fieldset.16.patch, failed testing.

liam morland’s picture

Status: Needs work » Needs review
Issue tags: +Accessibility, +aria, +a11ySprint

#16: drupal8.aria-fieldset.16.patch queued for re-testing.

mgifford’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new112.18 KB

@sun this applies nicely & provides the same results in the HTML .

This looks like a good improvement on the earlier patch.

mgifford’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +JAWS

Apparently we should be careful with aria-describedby. It crashes the browser in IE8+some versions of Jaws if target has more that 1024 characters of content.

Something funny with how Jaws does aria-describedby that causes memory issues that lead to crash situation.

liam morland’s picture

Status: Needs work » Needs review
StatusFileSize
new1.7 KB

I hate having to work around crap like this. This version of the patch only generates @aria-describedby if the #description is <= 1024 characters.

liam morland’s picture

Is it only IE8? If so, perhaps we should just expect JAWS users to upgrade their IE.

mgifford’s picture

Issue tags: -Accessibility, -aria, -a11ySprint, -JAWS

Status: Needs review » Needs work
Issue tags: +Accessibility, +aria, +a11ySprint, +JAWS

The last submitted patch, drupal8_aria-fieldset_1645420.patch, failed testing.

mgifford’s picture

Status: Needs work » Needs review
StatusFileSize
new1.96 KB

Rerolling the patch!

liam morland’s picture

Thanks.

sun’s picture

Status: Needs review » Reviewed & tested by the community

Well, I think that JAWS/IE is actually right in breaking badly on a too long description. Circles back into what I already said before: Our #description values do not contain the appropriate content for this aria-describedby reference.

But anyway, let's move forward with this.

mgifford’s picture

Status: Reviewed & tested by the community » Needs work

I'm going to set this back to needs review to verify that it doesn't crash IE8 for JAWS users.

Sun, thanks for restating your concerns. I do take them seriously and am reaching out to see if I can get a few more opinions.

nitinzd1985’s picture

Status: Needs work » Needs review
Issue tags: -Accessibility, -aria, -a11ySprint, -JAWS
mgifford’s picture

Issue tags: +Accessibility, +aria, +a11ySprint, +JAWS
mgifford’s picture

Issue tags: +RTBC Feb 18

@webchick, I am tagging this "RTBC Feb 18" as it has been ready, but just been really hard to find a Jaws user to test this patch. Otherwise it works as described.

Remove if required.

davidmacdonald’s picture

Status: Needs review » Reviewed & tested by the community

I have looked at the aria-describedby code... It is correct when a form field is created. I have tested it with NVDA 12 and Firefox 14 and it reads ok.

catch’s picture

Status: Reviewed & tested by the community » Needs review

Is there a bug report we could link to for the JAWS issue?

mgifford’s picture

I've never seen one for JAWS. Other screen readers do:
http://code.google.com/p/google-axs-chrome/issues/list
http://www.nvda-project.org/wiki/Development#IssueTracker

Closest I could find in JAWS (or VoiceOver) was:
http://stackoverflow.com/questions/tagged/voiceover
http://stackoverflow.com/questions/tagged/jaws

So, no. @catch I don't think there's anything we can file a bug report with.

mgifford’s picture

mgifford’s picture

StatusFileSize
new3.33 KB

Interdiff between @Liam Morland's patch in 21 & mine in 25.

mgifford’s picture

mparker17’s picture

mparker17’s picture

Assigned: Unassigned » mparker17

Testing.

mparker17’s picture

I had difficulty testing this one manually because most of the things that were fieldsets in D7 are now "details" in D8. Yay HTML5!

Here's how I managed to find a fieldset:

  1. Enable the core "Languages" module (drush -y en languages).
  2. Go to Home > Administration > Configuration > Regional and language (admin/config/regional/language), and add a language.
  3. Go to search/node and expand Advanced search.

But, no core fieldsets have descriptions, apparently, so you'll have to hack node.module in function node_form_search_form_alter and add one if you want to see the patch in action.

mparker17’s picture

Assigned: mparker17 » Unassigned
StatusFileSize
new885 bytes
new1.85 KB

Due to the problems described here, http://api.drupal.org/comment/49228#comment-49228 , I've had to re-roll the patch so the ID on the description is output.

Status: Needs review » Needs work

The last submitted patch, drupal-aria-describedby-for-fieldset-desc-1645420-41.patch, failed testing.

mparker17’s picture

Assigned: Unassigned » mparker17

I could swear I tested that before I wrote the patch... :P

mparker17’s picture

Assigned: mparker17 » Unassigned
Status: Needs work » Needs review
StatusFileSize
new655 bytes
new2.01 KB

Lets try this again!

mgifford’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new199.16 KB

This is good to go I think. Here's a screenshot from admin/config/people/accounts
ARIA-describedby screenshot

mgifford’s picture

Status: Reviewed & tested by the community » Needs review

Woops - @mparker17 just reached out on Skype to inform me that the "screenshot you posted demonstrated an aria described-by attribute on a form-control, not aria described-by attribtue to description elements on *fieldsets*"

Back to Needs Review. I was going back to examples in #5 after walking through the steps in #40 & not wanting to "hack node.module in function node_form_search_form_alter ... to see the patch in action."

mgifford’s picture

mgifford’s picture

mgifford’s picture

Status: Needs review » Needs work

The last submitted patch, drupal-aria-describedby-for-fieldset-desc-1645420-44.patch, failed testing.

Anonymous’s picture

Issue summary: View changes

adding links.

mgifford’s picture

Issue summary: View changes
Issue tags: +Accessibility, +aria

Adding the tags back in here.

mgifford’s picture

mparker17’s picture

mparker17’s picture

Assigned: Unassigned » mparker17

Rats, the patch doesn't apply anymore. I'll re-roll it.

mparker17’s picture

Assigned: mparker17 » Unassigned
Status: Needs work » Needs review
Issue tags: +a11y

Apparently testbot had a hiccup and didn't apply the patches the first time :P

mgifford’s picture

Now we just need to deal with #46 and providing relevant examples.

Perhaps from admin/config/people/accounts

mparker17’s picture

@mgifford I wasn't actually able to find a <fieldset> on that page when I tested the latest patch (in #44) last night... pretty much everything that used to be a <fieldset> is now a <details> element.

I spent a bit of time looking for fieldsets, but got distracted by dinner and being super-tired from a long week.

I don't know anything about the Form API's change from generally-using-<fieldset>s to generally-using-<details>, so I cannot tell if testing for #44's changes on a <details> element will produce a outcome relevant to this issue.

FWIW, when I tested last night, the <details> elements on admin/config/people/accounts had aria-describedby attributes, but there weren't corresponding id attributes in the page's HTML.

mparker17’s picture

Marking as "Needs issue summary update" since that would be really handy.

Here are the remaining tasks:

  1. Determine if this patch affects <details> elements as well, or whether we should file a separate issue for that.
  2. Figure out a working (manual) test case. Tagging as "Needs tests".
  3. Perform the test case with an a11y tool. Tagging as "Needs manual testing".
mgifford’s picture

They are easy to find on the user page with this patch here:
https://drupal.org/node/504962

This wraps all radios & checkboxes in the fieldset.

mparker17’s picture

Issue tags: +Novice

Actually, tagging as "Novice", since the issue summary update and steps 1 and 2 should be pretty simple.

mparker17’s picture

This change record might be a good place to start researching: All collapsible fieldsets have been replaced with HTML5 details elements.

mgifford’s picture

sun’s picture

Category: Feature request » Task

This will need a re-roll after #2152209: Convert theme_fieldset() to Twig has landed.

Is the situation with that JAWS bug for descriptions longer than 1024 characters still the same today, or can we remove that adjustment?

I wonder whether it would make sense to move the follow-up patch into a new issue? The original patch was committed ~1 year ago already, and my original follow-up patch was meant to be committed as a super-quick follow-up only. Then we suddenly ran into that JAWS bug...


@mgifford or someone else: Could we create a meta issue for all (Form API related) accessibility issues that need to be resolved before beta/release? — A concrete overview (via parent issue link relationships) would be very helpful to have.

mgifford’s picture

Looks like this might have been resolved in JAWS 14.0.1823 (April 2013) - http://www.freedomscientific.com/downloads/jaws/JAWS14-previous-enhancem...

This will still affect some users, but I think it might be alright to remove the adjustment. Partly this will depend on D8's lifecycle.

I've created an meta issue #2203649: Remaining Open Form API related Accessibility Issues - don't think I missed anything, but if so please edit it.

mgifford’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll
mgifford’s picture

What happened to theme_fieldset() anyway? Not sure how to re-write this patch.

rocketeerbkw’s picture

Issue summary: View changes

Updating this issue with task instructions in preparation for the sprints at Drupalcon austin.

jdillick’s picture

Hi, working from mentored code sprints at Drupalcon Austin. I'm going to see if the patch needs to be rerolled.

jdillick’s picture

Assigned: Unassigned » jdillick
jdillick’s picture

StatusFileSize
new75.71 KB

Ok, not sure if anything needs to be done on this issue. Attached is a screen shot of a fieldset with a description from the site branding block configuration at /admin/structure/block/add/system_branding_block/bartik

<fieldset aria-describedby="edit-settings-block-branding--description" id="edit-settings-block-branding" class="form-wrapper form-item">

aria-describedby attribute is added in template_preprocess_fieldset() in core/includes/form.inc.

It doesn't look like the patch needs a reroll. Does core already address the issue?

John

jdillick’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
jdillick’s picture

Assigned: jdillick » Unassigned
jdillick’s picture

Issue summary: View changes
mgifford’s picture

Status: Needs review » Closed (cannot reproduce)

Looks like it's fixed now in Core I couldn't replicate the problem on a fresh install.

liam morland’s picture

Issue tags: -a11y