-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[A11Y] CSS IDs not being added automatically to form items #4999
Comments
yes. The idea is that there may be any number of forms on a page (news letter signup, comment form, search box in the header, search box in the footer, etc) and by allowing core to assign the IDs, then we can ensure that each one is unique.
Core should be adding these automatically, too. (I know it does for radios and checkboxes). If that's not happening, maybe we should look closer at why? |
In #4997, we ended up manually adding the ID in that search box, to fix accessibility: function admin_bar_links_search() {
$search['search'] = array(
'#pre_render' => array(),
'#attributes' => array(
'class' => array('admin-bar-search'),
),
);
$search['search']['search'] = array(
'#type' => 'search',
'#title' => t('Admin search'),
'#title_display' => 'invisible',
'#attributes' => array(
'placeholder' => t('Menu search'),
'autocomplete' => 'off',
'autocorrect' => 'off',
'autocapitalize' => 'off',
),
'#id' => 'admin-bar-search-items', // <-- why does this need to be added manually???
);
return $search;
} |
This is great, we can do the same thing in admin bar :D |
Sorry @jenlampton for messing the issue title. This was already done for the admin bar; we now need to ensure that this is consistent for all form items. |
This popped up in another issue and I wasn't able to figure out:
Are IDs for core form items supposed to always get generated automatically, or are there valid cases, where this shouldn't happen?
The downside of a missing ID is that the
for="the-input-id"
attribute on the label can't get added, which means an accessibility regression.The text was updated successfully, but these errors were encountered: