Opened 9 years ago
Closed 12 months ago
#39952 closed defect (bug) (worksforme)
Category Dropdown Widget: required spacing issue on attachments template
| Reported by: | tribalNerd | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Widgets | Version: | 4.7.2 |
| Severity: | normal | Keywords: | reporter-feedback |
| Cc: | Focuses: |
Description
This issue only happens on the attachments.php template, all other primary templates don't appear to have the issue.
When using the category widget as a dropdown, the select statement looks like: <selectname='cat' rather than <select name='cat'
The file, category-template.php output statement is:
<?php $output = "<select $required name='$name' id='$id' class='$class' $tab_index_attribute>\n";
Removing $required corrects the issue.
Setting required to true also corrects the issue.
<?php function categories_dropdown($args) { $args['required'] = true; return $args; } add_filter( 'widget_categories_dropdown_args', 'categories_dropdown' );
Which returns:
<select required="" name="cat" id="cat" class="postform">
While this does correct the issue, the required="" isn't correct either, it should be: required without the =""
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select
It should also have aria-required="true" for Safari.
Change History (3)
#1
in reply to: ↑ description
@
9 years ago
- Keywords reporter-feedback added
#2
@
6 years ago
- Component General → Widgets
The spacing issue may have been fixed by now; I don't see a problem with it on Twenty Ten's attachment page. If you still see the spacing problem, could you mention which theme you use?
Default category dropdown:
<select name='cat' id='cat' class='postform' >
Category dropdown after applying filter:
<select required name='cat' id='cat' class='postform' >
The required attribute does not have the equal sign in the markup, but it does appear as required="" when inspecting the element within the browser.
Support should be better now for the required attribute, though the aria-required attribute could be good to add anyway.
#3
@
12 months ago
- Milestone Awaiting Review
- Resolution → worksforme
- Status new → closed
I tried this again with Twenty Twenty-One, and the select element had spaces between each attribute.
Without the required attribute:
<select name='cat' id='cat' class='postform'>
Adding $args['required'] = true; in the widget_categories_dropdown_args filter:
<select required name='cat' id='cat' class='postform'>
Also, tickets such as #39045 and #43415 have removed aria-required when the element has required.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Would you mind telling how to reproduce the issue? An example code would be handy.
Replying to tribalNerd: