Opened 10 years ago
Closed 10 years ago
#31749 closed defect (bug) (fixed)
submit_button() should not output empty name attribute
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.2 | Priority: | normal |
Severity: | normal | Version: | 4.1 |
Component: | Administration | Keywords: | has-patch |
Focuses: | ui, accessibility | Cc: |
Description
Quickly discussed on Slack with @azaozz and the accessibility team, see
https://wordpress.slack.com/archives/accessibility/p1426709000002222
submit_button()
, see also get_submit_button()
, outputs an empty name attribute when an empty string is passed. This happens in several places in the admin, see for example in class WP_List_Table, where search_box() calls it this way:
submit_button( $text, 'button', '', false, array('id' => 'search-submit') );
According to the specs:
http://www.w3.org/TR/html5/forms.html#naming-form-controls:-the-name-attribute
4.10.19.1 Naming form controls: the name attribute
The name content attribute gives the name of the form control, as used in form submission and in the form element's elements object. If the attribute is specified, its value must not be the empty string.
Would recommend to fix this not just for the sake of formal compliance with the specs but also because seems is triggering a weird bug in ChromeVox, TL;DR, reported by our accessibility testers group:
Michelle DeYoung
Win8.1/Chrome/Chromevox
When tabbing the user can tab to the action links in the Comments section and access them. I did notice that if ‘Quick Edit’ is selected the user is jumped out of the table and focus is taken to the Search box.
Regardless of browsers and Assistive Technologies bugs, an empty name attribute it's pretty useless and seems it doesn't harm to remove it. See proposed patch and some screenshots for reference.
Attachments (1)
Change History (7)
#4
in reply to:
↑ 3
@
10 years ago
Replying to SergeyBiryukov:
Sure, there is no point in having empty ID attributes. This function seems somewhat redundant, and at 42 lines of code it is more constraining than useful... Seems it just complicates something as simple as adding one HTML tag.
No wonder it is not used most of the time. As far as I see it is used only at 5 places in wp-admin, and there are about 40 "standard" submit buttons :) Perhaps we should look into deprecating it.
Should the same be applied to
id
attribute?