I was using WebAIM's Firefox plugin to evaluate a bunch of admin pages in Drupal.

All have problems with missing labels:

admin/structure/types/manage/article/comment/display
admin/structure/types/manage/article/comment/fields
admin/structure/types/manage/article/display
admin/structure/types/manage/article/fields

This is usually pretty easy to add, but it is time consuming to go in and add in the titles and ensure they describe the field in a meaningful way.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Everett Zufelt’s picture

If there is no label or name (see resource below) for these controls then this issue should be marked as a critical bug.

Resource:

Name, Role, Value: WCAG 2.0 success criteria 4.1.2 priority A
http://www.w3.org/TR/UNDERSTANDING-WCAG20/ensure-compat-rsv.html

Note: This success criterion is primarily for Web authors who develop or script their own user interface components. For example, standard HTML controls already meet this success criterion when used according to specification.

mgifford’s picture

There are no labels associated with these elements.

As a quick afterthought. These labels can be added at any time. There's no reason to stop a release to add these. It has no UI changes so should simply be a technicality that is identified & corrected.

It needs to be fixed. But I don't know that it should be marked critical if it is assumed it will be brought into core quickly.

Everett Zufelt’s picture

Priority: Normal » Critical

@mgifford

I don't want to assume that something can be brought into core after 7 is released without documentation. Marking as critical for now. Would be happy to set back to normal if confirmation can be provided by someone that this change can be made after release.

Bojhan’s picture

Strange is this in CCK then too?

Jeff Burnz’s picture

sub

andypost’s picture

Priority: Critical » Major

this could be fixed while beta stage

andypost’s picture

del

mgifford’s picture

I was just starting going through the site with this Firefox plugin - http://wave.webaim.org/toolbar

Labels are missing all over the admin interface. However the good news is that it really should present no problems to find & insert descriptive text to resolve this problem.

If there's a commitment to find & get labels properly identified I think we're fine. There are a lot more that we need to find.

andypost’s picture

@mgifford we need native english speaker for wording of labels

yched’s picture

Title: Labels missing in most admin forms. » Field UI overview screens : add missing labels with #label_display = FALSE
Component: field system » field_ui.module

Yes, for most of those fields we don't display a label, because visually the label is the table column header. Adding actual labels above the form elements would add to much cruft.

However, for accessibility reasons, those labels should be set as #title in the form element, and simply hidden with '#title_display' => 'invisible',.
This is what was done for all 'weight' elements used for tabledrag, in #448292: Drag and Drop for table rows is not accessible to screen-reader users. However, the Field UI screens has other form elements without a label, which need to receive the same treatment.

Has been on my TODO for a while, will try to come up with a patch soon.

Everett Zufelt’s picture

Depending on what is easier, it is just as useful to set the title attribute on the form field.

yched’s picture

Well, #448292: Drag and Drop for table rows is not accessible to screen-reader users went with #title + #title_display, we should stay consistent with that.

mgifford’s picture

Title: Field UI overview screens : add missing labels with #label_display = FALSE » Field UI overview screens : add missing labels
Status: Active » Needs review
FileSize
3.66 KB

Using the title_display as per normal.

Jeff Burnz’s picture

Status: Needs review » Needs work
+++ modules/field_ui/field_ui.admin.inc	15 Aug 2010 19:06:54 -0000
@@ -339,6 +339,8 @@ function field_ui_field_overview_form($f
+        '#title_display' => 'invisible', ¶

aha, whitespace, you love them mike - pita but must go :)

Powered by Dreditor.

yched’s picture

Thks for stepping in, mgifford.

The labels that were added by #448292: Drag and Drop for table rows is not accessible to screen-reader users include the field label :
'#title' => t('Weight for @row', array('@row' => $extra_field['label'])),
The logic is that, if you depend on a screen reader reading out input labels to navigate in a form, just reading 'Weight' gives you the column where you are in the table, but not the row, leaving you equally lost.

Also : in each row, the 'parent' form element should also get a hidden title.

mgifford’s picture

Status: Needs work » Needs review
FileSize
4.02 KB

@Jeff - Damn spaces! Thanks.

@yched I'm really not sure if adding field label is going to be useful here or not. In the case of the weights for Drag/Drop we've got a table that generally has a few form elements in it, but mostly a lot of almost identical rows where it would be rather easy to loose your place as you are navigating through it.

In most of the cases with fieldsets I've run against there is one or two that are associated with a more complex set of data. I'm not sure if adding the extra details will add much. We want to add context, but not add redundant info if we can avoid it.

So how are fieldsets being used and is there a good case for adding much more detail about how they are presented. Are the descriptions good enough? Do they need more info?

mgifford’s picture

Sorry, realize now I missed a bunch in that last patch when I was running through and making this other version that uses titles instead of labels. Patch above still needs a bunch of work.

It's simpler generally, but makes the attributes longer and also adds in warnings for tools like WebAim that are looking for labels and alert folks about "ALERT: Unlabeled form element with title"

This isn't an accessibility problem so if folks prefer to do it with titles that's fine.

yched’s picture

Well, the important thing is consistency. I personnally don't have a strong nor well-informed preference, but if the 300+ comment-long #448292: Drag and Drop for table rows is not accessible to screen-reader users settled on #title + #title_dislpay = 'invisible', we should not take a different route on a whim - neither revive the lengthy debate here...

Also, the 'Manage display' screen has its own form elements without labels on *all* rows, so consistency wrt including the row name in the hidden label will be needed there too.

mgifford’s picture

I can certainly re-roll it with the labels instead of titles. It is more consistent.

And for clarity the 'Manage display' screen is admin/structure/types/manage/article/display

Everett Zufelt’s picture

@yched

Just to clarify, the issue you point to had almost nothing to do with labeling form fields. I doubt there was ever a debate on the topic. I'm just saying there is not point in having labels. If it is easier or if you think it is more desireable for consistency then great. I personally would use the title attribute.

mgifford’s picture

FileSize
8.12 KB

@yched, I caught the changes in Manage display in this patch, thanks.

I also reverted to using invisible labels rather than titles. In D8 when FAPI gets reworked it will be easier to simply swap this for attribute rather than invisible. However, it's really hacky doing it as I did in #17. It's just a messy way to present the info and the way I did it in this patch is much easier to see.

yched’s picture

+++ modules/field_ui/field_ui.admin.inc 17 Aug 2010 14:59:52 -0000
@@ -227,12 +227,16 @@ function field_ui_field_overview_form($f
+          '#title' => t('Parent for !title', array('!title' => $instance['field_name'])),
(...)
+          '#title' => t('Parent for @row', array('@row' => $extra_field['label'])),

Consistency :
- '@' or '!' ?
- 'row' or 'title' ?

+++ modules/field_ui/field_ui.admin.inc 17 Aug 2010 14:59:52 -0000
@@ -373,12 +383,16 @@ function field_ui_field_overview_form($f
+        '#title' => t('Date type'),

Typo : Dat*a* - Actually, the common terminology is 'Field type' here.

+++ modules/field_ui/field_ui.admin.inc 17 Aug 2010 14:59:52 -0000
@@ -387,6 +401,8 @@ function field_ui_field_overview_form($f
+        '#title' => t('Form element'),

Terminology : 'Widget type'

+++ modules/field_ui/field_ui.admin.inc 17 Aug 2010 14:59:52 -0000
@@ -759,6 +785,8 @@ function field_ui_display_overview_form(
+      '#title' => t('Select options for !title', array('!title' => check_plain($instance['label']))),

Let's not suddenly switch to 'imperative verb' formulation.
+ Terminology
--> Should rather be : 'Label display for !title' (or @row or whatever :-)

+++ modules/field_ui/field_ui.admin.inc 17 Aug 2010 14:59:52 -0000
@@ -778,6 +806,8 @@ function field_ui_display_overview_form(
+      '#title' => t('Select formatter options for !title', array('!title' => check_plain($instance['label']))),

'Formatter for !title'

+++ modules/field_ui/field_ui.admin.inc 17 Aug 2010 14:59:52 -0000
@@ -897,6 +929,8 @@ function field_ui_display_overview_form(
+      '#title' => t('Display for !title', array('!title' => check_plain($extra_field['label']))),

'Visibility for !title'

All in all, since these labels are hidden by nature, it would possibly help to post screenshots of those 2 screens, annotated with the proposed 'hidden' labels ;-)

+ Odd display artifacts on 'Manage Fields' screen, 'add existing field' row :
[edited out : those visual bugs are present in current HEAD. Never mind the attached picture. Odd]

Bojhan’s picture

Your saying screen shots of hidden stuff? :D I am looking forward to those.

yched’s picture

Status: Needs review » Needs work

Created #888438: Field UI "Manage fields' visual glitch for the visual bugs mentioned in #22.

+ Setting patch back to CNW

yched’s picture

re @Bojhan #23 : I'm saying *annotated* screenshots :-p. If they were just regular labels, checking the consistency and relevance of the newly added labels would be easily done just looking at the page. But since we're talking about hidden labels, we currently need to browse the code or expand the various parts of the DOM in Firebug.

mgifford’s picture

Status: Needs work » Needs review
FileSize
8.49 KB

@yched - I do hope you're joking about the screen-shots. If someone wants to check I've applied it to my sandbox:
http://drupal7.dev.openconcept.ca/

Thanks for those changes. That's exactly what I needed. Very useful. I've re-rolled the patch with those changes.

yched’s picture

Status: Needs review » Needs work
FileSize
27.7 KB
20.12 KB

Absolutely not joking about screenshots : how else do you get a fair overview of the UI changes addeed here ?

However, figured out that we don't need to manually annotate a screenshot : playing with the element-invisible class in firebug to unhide the labels and paint them red does the trick. Screenshots attached.

Which shows :

"Manage fields" screen :
- we don't distinguish enough the labels between 'add new' and 'add existing' rows. Figure a blind user trying to guess where he's tabbed himself into.
- 'Form element' on 'add existing field' row needs to be 'Widget type'

"Manage display" screen :
- "Select options for [row]" needs to be "Label display for [row]"

Other feedback from UX folks welcome.

Bojhan’s picture

Looks good, I dont know wheter screenreaders dont cross link column titles. Dont want to repeat to much.

mgifford’s picture

Thanks @yched & @Bojhan.

As far as an overview of changes, I love http://meld.sf.net for that, but it's not for everyone.

Totally a good approach to use firebug to override the invisible text and display it as red. It's a nice way to display the issue.

Your description of the screenshots also helps Everett & others understand what we're talking about. I don't usually provide enough descriptions when tossing up a screenshot.

On "'Form element' on 'add existing field' row needs to be 'Widget type'" - Totally. And it's interesting how easy it is to see this when it's visible then when it's just in the code. There is definitely value to spitting it out as a screenshot. I can certainly repatch this.

There are really times when best is the enemy of good. I don't think we're at this point yet, but there are lots and lots of little issues like this that are just hanging there. I've quickly done a number of patches to improve this, but none of us can afford to spend this much time evaluating every one of them. And what I initially proposed is much better than what is in core now. That being said, this review process is useful.

@yched - do you have any idea on how to better differentiate between "'add new' and 'add existing' rows"? I'm really not particular about exactly what text is there and your suggestions have been great thus far.

@Bojhan - as far as the table headers go, there is no worry about repeating the elements. Having descriptive labels is presently the most important piece. Although the tables could be improved by adding scope="col" as is done here:
http://webaim.org/techniques/tables/data

Having a word or two repeated in a label won't be a problem for the vast majority of users.

mgifford’s picture

Status: Needs work » Needs review
FileSize
70 KB
101.39 KB
156.07 KB
167.79 KB
177.6 KB
8.55 KB

Ok, I think I've included all of the good suggestions from #27.

Everett Zufelt’s picture

Status: Needs review » Needs work

Looks good.

Where placeholder is user input can you please use @placeholder instead of !placeholder?

Thanks.

mgifford’s picture

Status: Needs work » Needs review

#30: field_ui_label_v6.patch queued for re-testing.

mgifford’s picture

I tried modifying the patch to use @ and then applying it. This resulted in a problem so I'm just trying to apply this to see if the patch still works as is.

Status: Needs review » Needs work
Issue tags: -Accessibility

The last submitted patch, field_ui_label_v6.patch, failed testing.

Everett Zufelt’s picture

Status: Needs work » Needs review

#30: field_ui_label_v6.patch queued for re-testing.

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

The last submitted patch, field_ui_label_v6.patch, failed testing.

mgifford’s picture

Status: Needs work » Needs review
FileSize
9.47 KB

Keeping up with core & conversion to @ from !

Everett Zufelt’s picture

+1 from me. This is a pretty long patch so I'd love another person to review and RTBC.

Status: Needs review » Needs work

The last submitted patch, field_ui_label_v7.patch, failed testing.

mgifford’s picture

There's something messed up in the code somewhere. I'm getting this error when it's applied:

Fatal error: Unsupported operand types in includes/form.inc on line 1546

Might be what's tripping up the bot here, but it applies nicely so it's a bad error if it is.

Someone will have to go through and figure out what's wrong.. I must have missed something..

Everett Zufelt’s picture

Perhaps someone more familiar with the inner workings of Field UI will take a look.

yched’s picture

This line looks broken - results in invalid PHP :

-        '#attributes' => array('class' => array('field-weight')),
++        '#title' => t('Weight for @title', array('@title' => $extra_field['label'])),

On http://drupal.org/files/issues/screen-capture-2_3.png :
- "New field type" / "New widget type" / "Existing widget type" are wrong.
Should be :
"Type of new field" / "Widget for new field" / "Widget for existing field"
- The titles should use $instance['label'] (i.e "Image"), not $instance['field_name'] (i.e "field_image")

On http://drupal.org/files/issues/screen-capture-4_3.png :
- "Select options for [label]" should be "Label display for [label]"

mgifford’s picture

Status: Needs work » Needs review
FileSize
9.84 KB

Thanks that was great. Sorry, I forgot the + from the cutting/pasting from the previous patch.. Annoying. Least you made some other improvements!

mgifford’s picture

Attaching screen shots.

yched’s picture

Issue tags: +Needs usability review

Looks good to me. Pinging UX folks for string review.

mgifford’s picture

Issue tags: -Needs usability review

All the added text is invisible, so I don't think it does need a Usability review. Just needs someone to look over it and mark it RTBC. We're just adding invisible labels after all not changing the look feel of the pages.

Bojhan’s picture

Status: Needs review » Reviewed & tested by the community

@mgifford I think he just wanted someone to do a text review. I just reviewed it - there seem to be some inconsistencies in sequencing of words but that seems rather minor.

mgifford’s picture

Thanks! I do think that it would be good to have a document outlining the best practices for implementing hidden labels for core fields. I suspect that there are some other inconsistencies depending on when the patches were originally written.

However, these are minor issues that can be cleaned up as part of a broader review I would think.

Everett Zufelt’s picture

Agreed we need documentation. My goal for this afternoon is to document #title_display in the D7 FAPI documentation. Once we have that done we can at least have a reference for how to hide titles. ad can build out more explanatory docs from there.

bowersox’s picture

Great work on all this labeling!

sun’s picture

Status: Reviewed & tested by the community » Needs work

oh why oh why do I hit yet another one of this...

+++ modules/field_ui/field_ui.admin.inc	21 Sep 2010 13:00:13 -0000
@@ -330,12 +330,16 @@ function field_ui_field_overview_form($f
+        '#title' => t('Weight for @title', array('@title' => $instance['label'])),
...
+          '#title' => t('Parent for @title', array('@title' => $instance['label'])),

@@ -394,14 +398,16 @@ function field_ui_field_overview_form($f
+        '#title' => t('Weight for @title', array('@title' => $extra_field['label'])),
...
+          '#title' => t('Parent for @title', array('@title' => $extra_field['label'])),

@@ -883,6 +907,8 @@ function field_ui_display_overview_form(
+        '#title' => t('Weight for @title', array('@title' => check_plain($instance['label']))),

@@ -890,6 +916,8 @@ function field_ui_display_overview_form(
+          '#title' => t('Label display for @title', array('@title' => check_plain($instance['label']))),

@@ -901,6 +929,8 @@ function field_ui_display_overview_form(
+        '#title' => t('Label display for @title', array('@title' => check_plain($instance['label']))),

@@ -914,6 +944,8 @@ function field_ui_display_overview_form(
+        '#title' => t('Formatter for @title', array('@title' => check_plain($instance['label']))),

@@ -1037,6 +1069,8 @@ function field_ui_display_overview_form(
+        '#title' => t('Weight for @title', array('@title' => check_plain($extra_field['label']))),

@@ -1044,6 +1078,8 @@ function field_ui_display_overview_form(
+          '#title' => t('Parents for @title', array('@title' => check_plain($extra_field['label']))),

@@ -1062,6 +1098,8 @@ function field_ui_display_overview_form(
+          '#title' => t('Visibility for @title', array('@title' => check_plain($extra_field['label']))),

@-placeholders already perform a check_plain(). Please CAREFULLY read http://api.drupal.org/api/function/t/7 - thanks.

Powered by Dreditor.

bowersox’s picture

@sun,

The top 4 lines in your code snippet look right to me, it is just the bottom 7 lines that need the check_plain() removed.

For example, this:

'#title' => t('Weight for @title', array('@title' => check_plain($instance['label']))),

should become:

'#title' => t('Weight for @title', array('@title' => $instance['label'])),

Is that correct? (Or is there anything that should change about the top 4 lines too?)

mgifford’s picture

Status: Needs work » Needs review

#43: field_ui_label_v8.patch queued for re-testing.

mgifford’s picture

I think field_ui_label_v8.patch also needs to be updated to keep up with head when applying it I get 8 out of 19 hunks FAILED. Thought I'd re-test it to verify.

@sun, thanks for the @-placeholders note. Sorry I missed that.

Status: Needs review » Needs work

The last submitted patch, field_ui_label_v8.patch, failed testing.

sun’s picture

Everett Zufelt’s picture

Bojhan’s picture

<webchick> And yes, I agree with one mega patch. Easier to review and commit.

Everett Zufelt’s picture

Priority: Major » Critical

Setting critical as per @webchick on irc.

Dries’s picture

We're reaching a point where we need to seriously ask ourselves whether patches like this are truly critical, or whether they can wait to D8. While important, I'm not convinced that this patch should be an absolute release blocker.

webchick’s picture

Well, the reason I feel it's critical is because it affects our WCAG compliance, which was given a huge push in D7. There are people actively prevented from using forms in Drupal atm because of this issue, which seems wrong to me. Drupal 7 should be for everyone, and Mike, Everett, Cliff, and the rest of the accessibility team have put in tremendous strides to see that happen.

This differentiates this particular patch from something like #925844: Tabledrag 'Show row weights' link needs to be larger in Seven in my mind, which is one user using one program having trouble finding one link. The patch that actually added that link on the page though was a critlcal accessibility bug fix. That's where the boundary is in my mind.

However, you could make the argument that several accessibility tests have been performed "in the field" with people without this issue being fixed and them not having a problem (or at least a documented one) getting around, and that draw conclusions from that that full WCAG compliance is an academic exercise we could push to D8.

I don't feel expert enough to make a call either way, so I deferred to the a11y team who've said this is important. Obviously, your call to make, Dries.

Everett Zufelt’s picture

The reason that we rely on WCAG 2.0 priority levels is so that we do not have to make a determination for each issue as to how it might impact potential users. WCAG 2.0 states that all form fields must have an accessible name, provided normally through a programmatically associated label or a title attribute, this is a priority A success criteria.

I can tell you that for some screen-reader users it is very difficult to use forms when accessible names are not provided for form fields. It can also be more difficult for voice command users to use forms when there are no accessible names (I witnessed this last night when a user of Dragon Naturally Speaking was using the D7 admin interface).

Can I give an example where any of the above issues would make any particular functionality completely impossible for any particular set of users, no. Do I trust that the time and effort that went into preparing WCAG 2.0 means that we should trust the expert guidance of that document, yes. Meeting level AAA success criteria might sometimes be an "academic exercise", possibly even level AA, but the level A criteria are the most fundamental and important to accessibility, as determined by the W3c.

*****

The Success Criteria were assigned to one of the three levels of conformance by the working group after taking into consideration a wide range of interacting
issues. Some of the common factors evaluated when setting the level included:

• whether the Success Criterion is essential (in other words, if the Success Criterion isn't met, then even assistive technology can't make content accessible)

• whether it is possible to satisfy the Success Criterion for all Web sites and types of content that the Success Criteria would apply to (e.g., different
topics, types of content, types of Web technology)

• whether the Success Criterion requires skills that could reasonably be achieved by the content creators (that is, the knowledge and skill to meet the
Success Criteria could be acquired in a week's training or less)

• whether the Success Criterion would impose limits on the "look & feel" and/or function of the Web page. (limits on function, presentation, freedom of
expression, design or aesthetic that the Success Criteria might place on authors)

• whether there are no workarounds if the Success Criteria is not met

bleen’s picture

Status: Needs work » Needs review
FileSize
22.87 KB

This patch is a reroll of #43 with the check_plain issue dealt with (from #51)

Additionally, this combines all the patches listed in #56 & #57 (except for #885946: Image file upload lacks labels because there is no patch there and #884932: Labels missing for search admin pages because it appears the patch there has been committed somewhere along the line)

Dries’s picture

Accessibility is obviously important and I'm both happy and proud that we made so many accessibility improvements in Drupal 7. I care about accessibility.

The reason I'm not convinced this is critical is because the form is most likely still usable without those labels -- it is just harder to use. Many parts of Drupal are hard to use -- we have a lot of usability and accessibility work to do. The point is that we're beyond the point where we should treat usability problems as critical bugs.

Status: Needs review » Needs work

The last submitted patch, mega-title.patch, failed testing.

Everett Zufelt’s picture

@dries

Almost everyone in the accessibility community understands WCAG A success criteria as critical as 'must' criteria. But, you are the boss. I am incredibly disappointed in the community for this decision.

verbosity’s picture

I'm a developer to whom accessibility is incredibly important, and a vital issue on some of the sites I work on. I have to agree with everett, simply put we should make the level A criteria.
not meeting accessibility criteria for such basic UI such as forms should not be acceptable. I feel that this should be critical, and be done now. How much better for it be for Drupal to be able to say that it meets such criteria out of the box?

Everett Zufelt’s picture

@Dries wrote:

The reason I'm not convinced this is critical is because the form is most likely still usable without those labels -- it is just harder to use. Many parts
of Drupal are hard to use -- we have a lot of usability and accessibility work to do. The point is that we're beyond the point where we should treat usability
problems as critical bugs.

---

I don't necessarily disagree with this, but the differentiation we can make is that some UIs are poorly usable for all (sucky but that's the way it is for now), accessibility is an attempt to make sure the UIs don't suck any extra for those with disabilities than they do for everyone else. Creating an unnecessary barrier to access for a certain segment of users is, IMO, not acceptable, and is not in alignment with our community's ideals and values.

Jeff Burnz’s picture

I can see both points of view, however at some point we have to concede that D7 is as good as we can get it. There are many bugs and issues in all software and while we can strive for perfection, its simply not attainable. For example there are many sucky things for sighted users also - and we're talking major wtf experiences that are not considered critical - for example Overlay can fail to load in many situations (path and domain prefix for languages, or even just using Garland will cause Overlay to fail in many instances).

So while it does suck we can't get everything fixed right now, we do have to take a deep breath and say enough is enough, lets fix things in D8 (with renewed energy and enthusiasm). D7 has been a huge learning curve for all of us I believe, and certainly for D8 we'll go into it much better organized, with a much clearer vision of what needs to be achieved.

Everett Zufelt’s picture

@Jeff

Can you provide one example of a sucky thing where persons without disabilities have a worse experience than those with disabilities

Jeff Burnz’s picture

I can't do that Everett because I am not physically disabled, therefor I can never fully empathize with an individuals personal physical challenges or their experience using Drupal. What I do know is that there are significant challenges for all users, at many different levels and not all of these will be addressed in Drupal 7.

That said Everett, yes I can actually provide multiple examples - Bartiks broken header can render menu items invisible (but accessible via keyboard), Vertical tabs in RTL are totally unusable for sighted users, Toolbar in RTL provides significant challenges for the sighted - I can go on and on Everett. Only the Vertical tabs in RTL is a critical issue because Drupal is unusable, however there are many other issues that simply make Drupal harder to use that are not deemed critical.

webchick’s picture

Well, I guess my big question is if this is a WCAG level A compliance thing, why on earth is it surfacing August/September 2010 and not a year ago when making these kinds of invasive changes would've been easier to sell?

Jeff Burnz’s picture

I can answer #72 quite easily - mainly because we're few in the accessibility team and we attacked the big hard issues first, which took a long time to fix. Also in the beginning we were not as well organized as we are now - so it was all a bit ad hoc rather than a clear list of issues we needed to address. In short we were learning Drupal accessibility as we went. I think for D8 we will be much better organized and have a very clear list of goals and how to execute them.

sun’s picture

Version: 7.x-dev » 8.x-dev
Priority: Critical » Major

This patch can be easily and happily backported at a later point in time, as the element labels are not visible. However, the proper fix for D8 is to additionally require a non-empty #title for all form elements via form_builder(), throwing an exception or error message if one without is encountered, so as to ensure that every form is accessible.

EDIT: That is, because Form API is not able to throw a form validation error for a form element without #title. You simply see the same form, without any error message.

Everett Zufelt’s picture

Version: 8.x-dev » 7.x-dev
Priority: Major » Critical

@Sun

1. Please let's allow Dries to make the call on this issue being D7 critical or not.

2. Your suggestion for throwing an error on a missing #title property is great, and should be a separate issue from this issue.

bowersox’s picture

I vote for D7. There is not much down-side to committing this patch. It is very low-risk. There are no UI or strings changes. All the form label changes are set to '#title_display' => 'invisible'. There is little risk but a lot to gain for a subset of users who need these labels to use Drupal.

The burden falls on the a11y team rolling this mega-patch to review and test until we have a solid patch. If we can do that before D7 is released, I think it's reasonable to commit this patch.

Everett Zufelt’s picture

@brandon

Not to be 'that guy', but the burden should be on the UI developers who developed the broken UIs in the first place, not the accessibility folk to go in and clean up afterward.

mgifford’s picture

It's a big change to how things are done in Drupal. There are a huge number of labels which will need to be applied. However, as Brandon says, this is very low-risk stuff. There's a lot of it, and I think we'll need to keep finding/fixing places where it is missed after D7 is released.

However, like other issues, I expect that these will work their way into maintenance & security releases within D7's lifetime. I've found a bunch of places where labels are missing, however I haven't done a comprehensive review. All I did to find them was work with my sandbox and apply the WebAim WAVE Toolbar to the admin side. I don't think I'd even known about this tool before August, but it's a great addition to testing previously awkward places.

There is no way that we will have found all of the missing labels with the effort that I did in August.

ksenzee’s picture

Assigned: Unassigned » ksenzee

I'll make a stab at getting the tests to pass.

ksenzee’s picture

Assigned: ksenzee » Unassigned
Status: Needs work » Needs review
FileSize
21.23 KB

I have no idea if my fixes a) solve any accessibility problems, or b) will make the tests pass. But here they are anyway.

sun’s picture

Status: Needs review » Needs work
+++ includes/form.inc
@@ -3024,9 +3024,17 @@ function form_process_tableselect($element) {
+          if (isset($element['#options'][$key]['title']['data']['#title']) && !empty($element['#options'][$key]['title']['data']['#title'])) {
+            $title_display = 'invisible';
+            $title = t('Select update options for @row', array('@row' => $element['#options'][$key]['title']['data']['#title']));
+          } else {
+            $title_display = '';
+            $title = '';
+          }
           $element[$key] = array(
             '#type' => 'checkbox',
-            '#title' => '',
+            '#title_display' => $title_display,
+            '#title' => $title,

1) #title_display should unconditionally default to 'invisible'.

2) !empty() is sufficient as condition for $title.

3) else doesn't adhere to coding standards. Could also be omitted by defining $title = ''; before the if.

+++ modules/book/book.admin.inc
@@ -174,7 +174,7 @@ function _book_admin_table($node, &$form) {
-function _book_admin_table_tree($tree, &$form) {
+ function _book_admin_table_tree($tree, &$form) {

mmm

+++ modules/book/book.admin.inc
@@ -191,11 +191,12 @@ function _book_admin_table_tree($tree, &$form) {
+        '#title' => t('Weight for @row', array('@row' => $data['link']['title'])),

+++ modules/field/field.form.inc
@@ -176,6 +176,8 @@ function field_multiple_value_form($field, $instance, $langcode, $items, &$form,
+            '#title' => t('Weight for row @row', array('@row' => $delta)),

+++ modules/field_ui/field_ui.admin.inc
@@ -330,13 +330,19 @@ function field_ui_field_overview_form($form, &$form_state, $entity_type, $bundle
+        '#title' => t('Weight for @title', array('@title' => $instance['label'])),

@@ -1046,6 +1080,8 @@ function field_ui_display_overview_form($form, &$form_state, $entity_type, $bund
+        '#title' => t('Weight for @title', array('@title' => $extra_field['label'])),

(and elsewhere) For translation's sake, we should standardize on "Weight for @title".

+++ modules/field_ui/field_ui.admin.inc
@@ -330,13 +330,19 @@ function field_ui_field_overview_form($form, &$form_state, $entity_type, $bundle
+        '#title_display' => 'invisible',
         '#attributes' => array('class' => array('field-weight')),
+        '#title_display' => 'invisible',
+        '#title' => t('Weight for @row', array('@row' => $instance['label'])),

Duplicate definition.

+++ modules/field_ui/field_ui.admin.inc
@@ -395,15 +401,17 @@ function field_ui_field_overview_form($form, &$form_state, $entity_type, $bundle
-        '#attributes' => array('class' => array('field-weight')),
+        '#title' => t('Weight for @title', array('@title' => $extra_field['label'])),
         '#title_display' => 'invisible',
-        '#title' => t('Weight for @row', array('@row' => $extra_field['label'])),
+        '#attributes' => array('class' => array('field-weight')),

@@ -450,8 +460,8 @@ function field_ui_field_overview_form($form, &$form_state, $entity_type, $bundle
-        '#title_display' => 'invisible',
         '#title' => t('Weight for new field'),
+        '#title_display' => 'invisible',

Please revert any unnecessary changes from this patch (like moving #attributes and #title_display in these examples)

+++ modules/filter/filter.admin.inc
@@ -34,7 +34,12 @@ function filter_admin_overview($form) {
+      '#type' => 'weight', ¶

(and elsewhere) Trailing white-space.

Powered by Dreditor.

ksenzee’s picture

Assigned: Unassigned » ksenzee

I am rerolling this tonight and will have it tomorrow.

ksenzee’s picture

Assigned: ksenzee » Unassigned
Status: Needs work » Needs review
FileSize
20.94 KB

This includes all of sun's feedback, I think. Let's see if it passes.

Status: Needs review » Needs work

The last submitted patch, 882694-83-add-labels.patch, failed testing.

ksenzee’s picture

Status: Needs work » Needs review
FileSize
20.83 KB

Oops - that was a git formatted patch. Try this one.

Status: Needs review » Needs work

The last submitted patch, 882694-85-add-labels.patch, failed testing.

Dries’s picture

Priority: Critical » Major

I think this is a major bug, not a critical bug. It would be a shame not to fix this before Drupal 7.0 is released, but at the end of the day, it shouldn't hold back the Drupal 7.0 release. As sun wrote, this patch can be easily and happily backported at a later point in time. If you keep working on it, it should land long before Drupal 7.0 is released. I promise to keep it on my radar.

mgifford’s picture

@Dries, I'm happy with http://drupal.org/node/927792#comment-3520074

We can keep working on this issue and bring it into Core ASAP. I do think this is a reasonable approach. I'm certain that we will get a number of accessibility reviews of Drupal 7 that will give us further room for improvement. We may not be able to get them all in D7 as there will no-doubt be some that affect the API or critical theme elements.

I do think that a number of us need to get better at writing & editing SimpleTest results to get a few more of these RTBC for D7 maintenance releases.

mgifford’s picture

Issue tags: +simpletests

tagging..

bowersox’s picture

Did some of these tests fail when these were individual patches rather than one mega-patch?

If so, looking at those shorter test results might help us identify which changes caused which failures.

Who is taking a stab at this?

mgifford’s picture

I wasn't in favour of this aggregation & have been pretty busy since it happened.

Way up in #56 @sun closed a bunch of other issues & created this massive one so that it would be easier for @dries & @webchick to review.

Sadly progress on this has really slowed down since that decision was made. I haven't had time to invest in debugging the aggregated patch (let alone verify that all of the issues addressed have been resolved in it).

I'd like to help, but don't know SimpleTest all that well & don't have a big block of time to devote to addressing a bigger issue just now.

Everett Zufelt’s picture

Agreed. I am not familiar enough with simpletest to try to whack this many failures. I was investigating some of the smaller issues prior to their closure.

A meta issue like this may be easier to review, but certainly is not easier to resolve, at least for me.

sun’s picture

Status: Needs work » Needs review
FileSize
26.03 KB

Re-rolled against HEAD.

sun’s picture

Issue tags: -simpletests
FileSize
20.86 KB

I don't see why this shouldn't pass.

sun’s picture

FileSize
21.4 KB

We only want to do this patch once, so here comes the hard core check.

sun’s picture

FileSize
21.45 KB

Sorry, forgot some.

Status: Needs review » Needs work

The last submitted patch, drupal.labels.96.patch, failed testing.

mgifford’s picture

Thanks for rolling (and re-rolling) this master patch @sun. It applies nicely in my sandbox, but I get this error:

Error message
User warning: search_block_form: Missing title for #type textfield. in form_builder() (line 1628 of /home/dm7/includes/form.inc).

On the home page after clearing my cache. I refreshed the code base & was able to replicate it with fresh code (no other patches applied).

sun’s picture

Status: Needs work » Needs review
FileSize
23.4 KB

Yes, that is in purpose. I've temporarily added an explicit PHP user warning to form_builder() whenever it encounters a form element that does not have a #title. We only want to do this patch once for D7. Of course, we'll remove that PHP user warning from this patch later on, but the goal is to make this patch pass - with the code that triggers explicit warnings.

Status: Needs review » Needs work

The last submitted patch, drupal.labels.99.patch, failed testing.

sun’s picture

Status: Needs work » Needs review
FileSize
29.93 KB

Status: Needs review » Needs work

The last submitted patch, drupal.labels.101.patch, failed testing.

mgifford’s picture

Status: Needs work » Needs review

I do wonder if it would make sense to split this into 3 separate issues rather than just one.

1) Some of the patches that were consolidated here are totally trivial. If there was a Quick fix tag at the time they'd probably already be in core.

2) Some of the issues trip up a hell of a lot of simpletests. Because of the size/complexity of this patch (well, probably more the simpletest fixes) it's proving difficult to nail down. However, it would be nice for someone to just look at the simpletest errors & be given some guidelines on how to do this. I suspect that much of it is pretty repeatable (this is the problem, here's how to address it). It just needs to be done 50 or so times to get fixed.

3) Finally there are still more complex missing form element titles that need to be added, especially for things like uploading attachments. I think those should stand alone as I don't know how close we are to fixing those.

Three different types of problems (easy, medium & hard) which I think should have been dealt with in 3 different issues (if not more).

I know this makes it a bit harder for @webchick & @dries, but I'd really like to see some more movement on this issue.

@sun's been doing some good work on trying to re-roll this. I'm also having computer grief at the moment, so am not going to be able to contribute as much till I sort things out again.

sun’s picture

@mgifford: Please note that it also makes patch reviews harder for people who have to review and sign off a patch -- which has to happen before Dries or webchick will even notice. By splitting issues, every patch reviewer would have to familiarize with each individual issue at hand, and double-check that the proposed changes are actually in line with what we want to do. Therefore, it only makes sense to merge these changes into a single patch, and get that one done right. Fixing those remaining failures should be doable within no time.

mgifford’s picture

@sun - It's not in my skill-set at this time to fix up up the remaining issues. If it was then I might share your perspective.

I want to see the many label issues that have been identified fixed. It also needs to be clear that this isn't going to fix all of the issues with missing labels.

I can review the patch when it is written, but I can't write this one.

ksenzee’s picture

Assigned: Unassigned » ksenzee

Let me take another crack at it.

ksenzee’s picture

FileSize
31.1 KB

This should get rid of a lot of the test failures. Some of them are spurious - the check in #99 catches all missing labels, even in places where we don't want them (such as the column of checkboxes on the permissions page, which is already labeled correctly and doesn't need another overall label for the group). But there are probably some real ones left.

Status: Needs review » Needs work

The last submitted patch, 882694-107-add-labels.patch, failed testing.

Everett Zufelt’s picture

Wow, this appears to be getting very close.

Can someone please give me a brief explanation of the difference between a test failing and there being an exception?

mgifford’s picture

Great job @ksenzee not sure about the 202 exceptions, but a big improvement for sure. It's down from over 1000 exceptions in the last patch.

sun’s picture

This means that @ksenzee fixed all previously existing test failures. All remaining exceptions are caused by form elements that do not define a #title.

Note that you can skip the exceptions for #type 'machine_name'. Form elements of this #type automatically get a default #title set, if no custom #title was specified.

The exception message was crafted in a way that it exposes the originating form_id + the element #type, so by looking at the test results, you should be able to identify the forms and form elements that still need to be fixed.

(To hide #type 'machine_name' from the exceptions, the corresponding condition in form.inc [in this patch] would need a quick fix.)

ksenzee’s picture

Yep, what @sun said. I'm fixing the remaining exceptions now, and I'll tweak the form.inc error condition to exclude some of the stuff we know is okay.

ksenzee’s picture

Status: Needs work » Needs review
FileSize
33.63 KB

Another round of fixes.

Status: Needs review » Needs work

The last submitted patch, 882694-113-add-labels.patch, failed testing.

ksenzee’s picture

Assigned: ksenzee » Unassigned

I've run out of time for the evening, so I'll unassign myself in case anyone else has time to finish up. The remaining exceptions are for form elements without titles in field_ui_field_edit_form and user_profile_form, plus a couple of test-only forms that don't matter.

yched’s picture

"elements without titles in field_ui_field_edit_form"

They are declared in image_field_instance_settings_form() - instance settings for image fields.

mgifford’s picture

@yched can you amend the patch and see if we can resolve this mega patch with all of the enhancements?

if not

@ksenzee is it worth pulling out the added label which is throwing the error and seeing if we can get most of the label issues fixed here now?

It's obviously my preference to get this all into core when it is released.

However, given the need for string translation some of the remaining label issues may be able to be addressed in point releases:
http://groups.drupal.org/node/99219

If we can work something out with the i18n folks that is.

mgifford’s picture

Note this related issue is missing:
#885616: Labels missing from a number of locale admin forms

And don't think it should be merged in here. I just wanted to point it out so it isn't forgotten.

yched’s picture

Status: Needs work » Needs review
FileSize
35.7 KB

OK, fixed the missing elements pointed by the test exceptions
- a couple elements in image_field_instance_settings_form() - some others in there were properly handled already.
- a couple test forms
- expanded #type = 'date' FAPI elements - form_process_date()

mgifford’s picture

Status: Needs review » Reviewed & tested by the community

Looks great.

I applied this to my sandbox http://drupal7.dev.openconcept.ca

I passes the bot!

Navigated around a bunch it all seems to be working fine.

Looking forward to having this in core.

sun’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
35.43 KB
+++ includes/form.inc
@@ -1623,6 +1623,16 @@ function form_builder($form_id, &$element, &$form_state) {
+    $titleless = array(
+      'submit', 'button', 'image_button', 'hidden', 'token', 'value',
+      'tableselect', 'password_confirm', 'machine_name',
+    );
+    $exceptions = array(
+      'user_admin_permissions', '_form_test_disabled_elements', 'form_label_test_form', 'form_test_limit_validation_errors_form',
+    );
+    if (!isset($element['#title']) && !in_array($element['#type'], $titleless) && !in_array($form_id, $exceptions)) {
+      trigger_error("{$form_id}: Missing title for #type {$element['#type']}, #id {$element['#id']}", E_USER_WARNING);
+    }

Of course, this has to be removed now.

+++ includes/form.inc
@@ -2998,9 +3013,16 @@ function form_process_tableselect($element) {
+            $title = t('Select update options for @title', array(
...
             '#type' => 'checkbox',
-            '#title' => '',
+            '#title' => $title,

This label sounds a bit odd. It's for a checkbox in a table, allowing to toggle whether something should be done with an item. Shortened that into "Update @title"

+++ modules/comment/comment.admin.inc
@@ -50,6 +50,8 @@ function comment_admin_overview($form, &$form_state, $arg) {
   $form['options']['operation'] = array(
     '#type' => 'select',
+    '#title' => t('Bulk update options'),

Same here, changed into "Operation".

+++ modules/file/file.field.inc
@@ -674,8 +674,11 @@ function file_field_widget_process_multiple($element, &$form_state, $form) {
+        //'#title_display' => 'invisible',

Removed stale comment.

+++ modules/locale/locale.admin.inc
@@ -35,11 +37,17 @@ function locale_languages_overview_form() {
+  $form['enabled'] = array(
+    '#type' => 'checkboxes',
+    '#title' => 'Enabled',

Missing t() and odd label. Changed into "Enabled languages".

+++ modules/locale/locale.admin.inc
@@ -35,11 +37,17 @@ function locale_languages_overview_form() {
+  $form['site_default'] = array(
+    '#type' => 'radios',
+    '#title' => t('Default'),

Same here. Changed into "Default language".

+++ modules/locale/locale.admin.inc
@@ -545,13 +553,20 @@ function _locale_languages_configure_form_language_table(&$form, $type) {
+        '#type' => 'checkbox',
+        '#title' => t('Enable @title language provider', array('@title' => $provider['name'])),

Removed the "Enable" prefix.

+++ modules/poll/poll.module
@@ -390,6 +390,8 @@ function _poll_choice_form($key, $chid = NULL, $value = '', $votes = 0, $weight
   $form['chtext'] = array(
     '#type' => 'textfield',
+    '#title' => t('Choice @number', array('@number' => $chid)),
+    '#title_display' => 'invisible',
     '#default_value' => $value,

@@ -397,6 +399,8 @@ function _poll_choice_form($key, $chid = NULL, $value = '', $votes = 0, $weight
+    '#title' => t('Vote count for choice @number', array('@number' => $chid)),

@@ -405,6 +409,8 @@ function _poll_choice_form($key, $chid = NULL, $value = '', $votes = 0, $weight
+    '#title' => t('Weight for choice @number', array('@number' => $chid)),

Don't think that the internal choice ID should appear anywhere in the UI. Changed all of those.

+++ modules/shortcut/shortcut.admin.inc
@@ -72,6 +72,8 @@ function shortcut_set_switch($form, &$form_state, $account = NULL) {
+      '#title' => t('Name for the new shortcut set'),

Shortened to "Name". We don't use such lengthy labels anywhere else.

+++ modules/simpletest/tests/batch_test.module
--- modules/simpletest/tests/form_test.module
+++ modules/simpletest/tests/form_test.module

Removed all testing module changes.

+++ modules/system/system.admin.inc
@@ -2930,6 +2932,8 @@ function system_actions_manage_form($form, &$form_state, $options = array()) {
+    '#title' => t('Create action'),

Shortened to "Action".

+++ modules/taxonomy/taxonomy.admin.inc
@@ -664,6 +670,7 @@ function taxonomy_form_term($form, &$form_state, $edit = array(), $vocabulary =
   $form['vocabulary_machine_name'] = array(
     '#type' => 'textfield',
+    '#title' => t('Machine name'),
     '#access' => FALSE,

Reverted this and fixed it properly: should be #type 'value', which is already used elsewhere for the same field in taxonomy.admin.inc.

Powered by Dreditor.

mgifford’s picture

Status: Needs review » Reviewed & tested by the community

Much better. Thanks everyone! I walked through some of the main pain points for missing fields with http://wave.webaim.org/toolbar

Oh ya, I applied this in my D7 sandbox if folks want to check it out, let me know http://drupal7.dev.openconcept.ca

@sun - I do think you've also made improvements in the text. Thanks again for the detailed review!

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks!

Status: Fixed » Closed (fixed)
Issue tags: -Accessibility

Automatically closed -- issue fixed for 2 weeks with no activity.