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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bowersox’s picture

Good. 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?

mgifford’s picture

I just asked on twitter. Hopefully I get some feedback from HTML5 experts out there.

Everett Zufelt’s picture

I don't understand the question. Can you please phrase it in a problem / needs improvement in html5 format?

mgifford’s picture

Brandon 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

Everett Zufelt’s picture

The 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.

mgifford’s picture

Ok, 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

Everett Zufelt’s picture

I 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?

Everett Zufelt’s picture

tag

fmizzell’s picture

Issue summary: View changes

Summarizing the Issue

fmizzell’s picture

Issue summary: View changes

Adding headers to encourage summary contributions

xjm’s picture

Summary 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.

mgifford’s picture

Issue tags: +html5

I'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.

mgifford’s picture

Issue summary: View changes

Link the original report to the original Issuer

mgifford’s picture

Issue tags: +mobile

This 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...

attribute: Set the title attribute on the element to create a tooltip but output no label element. This is supported only for checkboxes and radios in form_pre_render_conditional_form_element(). It is used where a visual label is not needed, such as a table of checkboxes where the row and column provide the context. The tooltip will include the title and required marker.

But this really needs to be extended to the other form elements in theme_form_element().

mgifford’s picture

Version: 8.x-dev » 9.x-dev

I 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.

mgifford’s picture

Issue summary: View changes

adding link to original

mitokens’s picture

mgifford’s picture

Version: 9.x-dev » 8.1.x-dev

Maybe this is something that could be dealt with in 8.1

alexdmccabe’s picture

Uploading 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.

alexdmccabe’s picture

Status: Active » Needs review
alexdmccabe’s picture

New patch, was missing a "for" in the docblock.

The last submitted patch, 15: drupal-title-display-attribute-934280-15.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 17: drupal-title-display-attribute-934280-17.patch, failed testing.

alexdmccabe’s picture

Aha. 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...

mgifford’s picture

Status: Needs work » Postponed
alexdmccabe’s picture

Status: Postponed » Needs review

Looks like this applies to 8.1.x now, setting back to needs review and hoping I don't need to reupload the patch...

alexdmccabe’s picture

I 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?

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.0-beta1 was released on March 2, 2016, which means new developments and disruptive changes should now be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

BarisW’s picture

Version: 8.3.x-dev » 8.2.x-dev
FileSize
2.12 KB

Here is a re-roll to rerun the testbot.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Needs review » Needs work

Patch no longer applies

Before that though think we need to know 1. is the task still valid and 2. issue summary update.

_utsavsharma’s picture

Status: Needs work » Needs review
FileSize
2.06 KB

Rerolled for 9.4.x
Please review.

smustgrave’s picture

Status: Needs review » Needs work

Thank you for the reroll but please read the comments too. Needs validity check and issue summary update

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.