Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Hello,
I have used a date popup/date picker in 'date from' and 'date to' fields. It fails the WAVE accessibility evaluation since the input element does not have a label associated. Could you please let me know how to fix this or if there is any patch available. Let me know if I need to provide you with more details.
Thank you.
Comment | File | Size | Author |
---|---|---|---|
#5 | date-label-accessibility-1571258-5.patch | 7.63 KB | David_Rothstein |
Comments
Comment #1
mgiffordI haven't reviewed this with WAVE. What was the error you received?
Comment #2
jkirby CreditAttribution: jkirby commentedHi,
I'm having the same issue with the date_popup picker when using it in a form. My understanding is that it's not specific to WAVE, but is a general accessibility issue under the WCAG2.0 guidelines. Basically an input element on a form should have a corresponding label, explicitly associated using the for attribute. Currently, this has failed our review due to the for attribute being associated to the wrapping div of the input element, not the input itself. See below:
Currently this is a mojor issue for us as we need to meet the WCAG2.0 AA guidelines. I would also be very interested in a patch or workaround for this and am happy to help out on the development work
Comment #3
mgiffordWAVE's pretty good. I wasn't trying to suggest that it wasn't promoting good accessibility best practices in line with WCAG.
Do you have an example of this somewhere? I don't have a convenient install to poke at. Do you have any resources to put into this? Ultimately it starts with someone writing a patch.
This is a module that is an issue considered for D8 core #501428: Date and time field type in core so accessibility is more of a concern.
Comment #4
mgiffordTwo related links about Calendar accessibility.
This might be one of the best ones as far as examples:
http://developer.yahoo.com/yui/calendar/
Also, a useful guide here:
https://www.webaccessibility.com/best_practices.php?technology_platform_...
Comment #5
David_Rothstein CreditAttribution: David_Rothstein commentedThis is a more general issue, I think, not limited to the date popup widget. (I ran into it with a select widget myself.)
Here's a patch that goes through the Date module and makes sure all widgets have labels for screen reader users even if they don't display visually.
Note: I needed a version of this patch for an older version of the Date module myself (and the code was slightly different so that the same patch didn't apply). I'm posting that too but feel free to ignore it. The one to review is the second one since that's against the latest 7.x-2.x-dev code.
Comment #6
David_Rothstein CreditAttribution: David_Rothstein commentedNote that #2 mentions the existence of orphaned form labels as well, but that's not quite the same thing as a missing form label (which my patch fixes).
For the orphaned form label issue, see discussion in #600236: Invalid XHTML "label for" when using popup.
Comment #7
David_Rothstein CreditAttribution: David_Rothstein commentedBy the way, I think a side effect of my patch is that it fixes some other functional bug as well:
Note the misspelling of the array key ('eleement') in the first line of the old code.
Comment #9
David_Rothstein CreditAttribution: David_Rothstein commentedThat test failure looks unrelated.
Comment #10
mgifford5: date-label-accessibility-1571258-5.patch queued for re-testing.
Comment #11
podarok#5 looks good
RTBC
Comment #12
vijaycs85Committed b248f8f and pushed to 7.x-2.x. Thanks!!!
Comment #13
vijaycs85