A related issue is that the checkbox for each row has no explicit label associated with it. The relevant "Title" cell's content could be wrapped in an associated label element, which might help. Or a title attribute containing the relevant "Title" could be added to the checkbox input.
The title isn't inserted in the checkbox so I've modified the form to ensure that it is passed along appropriately. It's up and running on my sandboxy here http://drupal7.dev.openconcept.ca/admin/content
| Comment | File | Size | Author |
|---|---|---|---|
| #23 | update_option_labels-3.patch | 1.22 KB | mgifford |
| #15 | tableselect-label.patch | 1.15 KB | casey |
| #6 | update_option_labels-2.patch | 1.22 KB | mgifford |
| update_option_labels-1.patch | 842 bytes | mgifford |
Comments
Comment #1
Everett Zufelt commentedHey, I have no idea what UI you're talking about here. Can you please be more specific about the problem and the solution?
Comment #3
mgiffordIf you click on the main 'Content' link in the toolbar you go to admin/content which provides you with a list of all recent content (that you can filter). You can also publish/unpublish/delete/etc content in mass by checking on the checkbox in the first column of the table on that page.
None of these checkboxes has a label associated with them. This patch adds a label.
There was a MySQL failure & no mysql so I'm going to assume that the bot was having trouble & retest this.
Comment #4
mgiffordupdate_option_labels-1.patch queued for re-testing.
Comment #6
mgiffordTrying this thanks to @Heine
Comment #7
mgiffordforgot to change status.
Comment #9
mgifford#6: update_option_labels-2.patch queued for re-testing.
Comment #11
casey commentedCan't you just set the title attribute?
Also, you can't expect the table to contain a title column.
Comment #12
mgiffordFor accessibility you want to set the title attribute, ensure that there is a label but you need to hide the label from the browser.
That's why the line for:
is there. There are no visual changes caused by the patch. It's completely different for screen readers, but folks not using assistive technology will never notice that it is there.
Just apply the patch yourself and see if you notice any changes.
Comment #13
casey commentedThe title attribute can also be considered a label (http://www.w3.org/TR/wai-aria/roles#namecalculation) and will be read by screen readers.
Comment #14
mgiffordyes, this is true. However, try it and look at the html.
Forms API does need to be re-written for D8 and hopefully it will include this at that time. However adding a title, like this:
http://api.drupal.org/api/drupal/developer--topics--forms_api_reference....
isn't very clean.
You could add an #attributes tag & insert the title there I suppose.
However, I'm really not sure what your concern is with the existing approach. It might fail a lot less & require less rewriting of tests I suppose..
Comment #15
casey commentedLabel is a visible element. I am aware of the element-invisible class, but we really should use it with care. If there is a (better) alternative we should use it. The title attribute also gives non-AT users the joy of tooltips.
Comment #16
mgiffordThe label isn't visible if the patch I provided is applied. It's a very simple patch.
When you tested your code did you see tooltips over the form elements? I don't think I've seen this before. I'm still not sure why you think it's a better approach.
The critical problem I find with your patch though is that you haven't added the title data using:
'Select this row' doesn't add value.
Comment #17
Everett Zufelt commentedChaning priority to Major, this is actually Critical, but can be fixed in beta.
Comment #18
mgiffordThis is a trivial change. There are going to be lots of them around. However, it's been sitting here since July 11th & I'd actually forgotten about it. Ended up reposting the issue & patch here:
#882672: Label missing in Update options
I'll mark that one as a duplicate, but let's get these simple accessibility labeling issues into core quickly.
@casey, title attributes do not add to accessibility in modern screen readers most of the time. It will not be displayed to the screen.
Comment #19
Everett Zufelt commentedI strongly prefer using the title attribute on the form field if the label is only going to be hidden.
Comment #20
mgiffordWoops.. @casey, guess I was wrong there in this context.
@everett - so the patch in #15 above works well for you?
So for all of these instances where I've been proposing labels you'd be happier if we were using title attributes instead for the form?
It's not a big change in code.
Comment #21
Everett Zufelt commented@mgifford
I haven't tested the patch. I just don't see why we would generate markup, and then hide it, when we have a title attribute in which the "label" can be placed.
There may be use cases for using a hidden label over a title, but I'm not sure what that would be.
It's been a long time since I visited the form labeling issue. But, here is what I recall the logic to be.
If you set #title a label is generated, so let's have a way to hide that. I am certain that I recommend that #title_display be able to be set to attribute, but I don't know if that was ever adopted. I think there may have been an issue where it was only able to be applied to radio and checkbox, but again I don't recall.
Comment #22
mgiffordThe initial vision of the implementation was that we'd have the attribute tag to associate with a title element so that we could just have the title included like it is for form_pre_render_conditional_form_element():
However there was some problem with this, so it only ever got brought into the pre render function for checkboxes and radios.
I can't recall the specifics but we weren't able to generalize it. I think that's going to have to wait till D8 to get properly implemented. (BTW - Where, when, how do we begin discussing the re-framing of FAPI for D8?)
I've set the title manually here http://drupal.org/node/882694#comment-3334358
It looks more hacky to me in the code. It also is giving a warning with tools like WebAIM's WAVE because it is less well understood than the label. Might act the same, but it isn't treated the same in the community. Most discussion is geared towards labels & forms not labels/titles & forms.
Comment #23
mgiffordUpdating to keep up with core. Reverting to using labels as it's the established pattern & will help with eventual migration to D8.
Comment #25
mgiffordI'm really at a loss as to how this test fails with the comment module.
Comment #26
mgifford#23: update_option_labels-3.patch queued for re-testing.
Comment #28
Everett Zufelt commented#23: update_option_labels-3.patch queued for re-testing.
Comment #30
mgiffordSeems totally absurd that this patch throws 73 fail(s), and 1 exception(es) in Simpltest.
That's a lot of code to meddle with. Need a Simpletest guru to fix this up quick!
Comment #31
sunPlease merge this patch into #882694: Add missing form element titles for accessibility. Thanks.