Opened 8 years ago
Last modified 4 years ago
#39952 new defect (bug)
Category Dropdown Widget: required spacing issue on attachments template
Reported by: | tribalNerd | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 4.7.2 |
Component: | Widgets | Keywords: | reporter-feedback |
Focuses: | Cc: |
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 (2)
#1
in reply to:
↑ description
@
8 years ago
- Keywords reporter-feedback added
#2
@
4 years ago
- Component changed from General to 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.
Would you mind telling how to reproduce the issue? An example code would be handy.
Replying to tribalNerd: