Problem/Motivation
Currently #title_display = 'attribute' can only be used with radio and checkbox form elements. We cannot use this property on all form elements in FAPI, but we should be able to use 'attribute' with all form element types native to the markup language in use (xhmtml .0 / html5). Implementing this change would help developers make forms more accessible to assistive technologies like screen-readers in xhtml 1.0 and html5.
Proposed resolution
TBD
Remaining tasks
Figure out what the original problem was that limited the use of the title attribute to only checkbox and radio
User interface changes
TBD
API changes
TBD
Original report by Everett Zufelt
Currently #title_display = 'attribute' can only be used with radio and checkbox form elements. We cannot use this property on all form elements in FAPI, but we should be able to use 'attribute' with all form element types native to the markup language in use (xhmtml .0 / html5).
Adding a reference to original source - #558928: Form element labeling is inconsistent, inflexible and bad for accessibility
Comment | File | Size | Author |
---|---|---|---|
#38 | 934280-38.patch | 2.06 KB | _utsavsharma |
#27 | drupal-title-display-attribute-934280-27.patch | 2.12 KB | BarisW |
#17 | interdiff-934280-15-17.txt | 770 bytes | alexdmccabe |
#17 | drupal-title-display-attribute-934280-17.patch | 2.12 KB | alexdmccabe |
#15 | drupal-title-display-attribute-934280-15.patch | 2.12 KB | alexdmccabe |
Comments
Comment #1
bowersox CreditAttribution: bowersox commentedGood. Do we always want to use the title attribute like this:
title="label goes here"
? In HTML 5 is the title attribute going to become any more accessible for assistive technologies?Comment #2
mgiffordI just asked on twitter. Hopefully I get some feedback from HTML5 experts out there.
Comment #3
Everett Zufelt CreditAttribution: Everett Zufelt commentedI don't understand the question. Can you please phrase it in a problem / needs improvement in html5 format?
Comment #4
mgiffordBrandon asked "In HTML 5 is the title attribute going to become any more accessible for assistive technologies?"
I don't know where this is going. I'll ask John http://twitter.com/#!/johnfoliot
Comment #5
Everett Zufelt CreditAttribution: Everett Zufelt commentedThe title attribute on a form field works quite well for screen-readers in xhtml 1.0 and html5. It obviously isn't very useful to those using a keyboard only, as it is only revealed on hover or to screen-readers. There is no planned change to this in html5 since html5 does not prescribe how a UA is to display its UI.
Comment #6
mgiffordOk, so it's a forward compatible solution. I think that's the crux of the concern.
I look forward to seeing this implementation in FAPI in D8. Gets back to this point though http://groups.drupal.org/node/97504
Comment #7
Everett Zufelt CreditAttribution: Everett Zufelt commentedI do not recall what the original problem was that limited the use of the title attribute to only checkbox and radio. Can anyone please enlighten me?
Comment #8
Everett Zufelt CreditAttribution: Everett Zufelt commentedtag
Comment #8.0
fmizzell CreditAttribution: fmizzell commentedSummarizing the Issue
Comment #8.1
fmizzell CreditAttribution: fmizzell commentedAdding headers to encourage summary contributions
Comment #9
xjmSummary added by fmizzell. Leaving tagged for now in the hopes that someone with more HTML5 knowledge can expand the summary with the information Everett has requested.
Comment #10
mgiffordI'd think that there could be some very minor performance enhancements by simply inserting a title than introducing an invisible label as we did in D7.
Comment #10.0
mgiffordLink the original report to the original Issuer
Comment #11
mgiffordThis was discussed in #558928-51: Form element labeling is inconsistent, inflexible and bad for accessibility but it was decided that we couldn't bring it into Drupal 7.
I'm adding the mobile tag to this, as it's just a lot less HTML to send if the title/input relationship is semantically made through the title attribute rather than the adding a label and then making it invisible.
It's added here for checkboxes & radios:
http://api.drupal.org/api/drupal/developer!topics!forms_api_reference.ht...
But this really needs to be extended to the other form elements in theme_form_element().
Comment #12
mgiffordI think this is going to need to be bumped to D9. It would be great if we could have this functionality, but it's a bit late in the D8 cycle.
Comment #12.0
mgiffordadding link to original
Comment #13
mitokens CreditAttribution: mitokens as a volunteer commentedComment #14
mgiffordMaybe this is something that could be dealt with in 8.1
Comment #15
alexdmccabeUploading a patch that ought to do the trick. I was able to use it to set
'#title_display' => 'attribute'
on a single checkbox (as opposed to checkboxes), textfield, and textarea, so it seems to be working.Comment #16
alexdmccabeComment #17
alexdmccabeNew patch, was missing a "for" in the docblock.
Comment #20
alexdmccabeAha. 8.1.x is really out of date, so patches don't apply. I guess I'll just let this one sit and wait then...
Comment #21
mgiffordComment #22
alexdmccabeLooks like this applies to 8.1.x now, setting back to needs review and hoping I don't need to reupload the patch...
Comment #24
alexdmccabeI set the patch to re-test a couple of weeks ago, but in the files section just below this comment field, it still says "Queued for testing". Is there some reason it's not testing? Do I just need to re-upload it with a different name?
Comment #27
BarisW CreditAttribution: BarisW at LimoenGroen commentedHere is a re-roll to rerun the testbot.
Comment #37
smustgrave CreditAttribution: smustgrave at Mobomo commentedPatch no longer applies
Before that though think we need to know 1. is the task still valid and 2. issue summary update.
Comment #38
_utsavsharma CreditAttribution: _utsavsharma at OpenSense Labs commentedRerolled for 9.4.x
Please review.
Comment #39
smustgrave CreditAttribution: smustgrave at Mobomo commentedThank you for the reroll but please read the comments too. Needs validity check and issue summary update