Opened 6 years ago
Closed 3 years ago
#48030 closed defect (bug) (fixed)
HTML5 input types are not being reset when submitting the addtag form
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.0 | Priority: | normal |
Severity: | minor | Version: | |
Component: | Taxonomy | Keywords: | needs-testing has-patch |
Focuses: | ui, javascript, administration | Cc: |
Description (last modified by )
The addtag
form on wp-admin/edit-tags.php
automatically clears the new term's name, slug, and description field but will *not* clear any visible inputs beyond input[type="text"]
and textarea
.
The offending bit of code is in js/_enqueues/admin/tags.js
:
$('input[type="text"]:visible, textarea:visible', form).val('');
If we broaden the scope a bit, we can hit all visible inputs but still exclude checkboxes + radios.
Attachments (4)
Change History (14)
#3
@
3 years ago
- Component changed from Administration to Taxonomy
- Milestone changed from Future Release to 6.0
#6
@
3 years ago
- Keywords needs-patch added; has-patch removed
- Resolution fixed deleted
- Status changed from closed to reopened
The selector is a little eager and removes the text from the submit button too. I've added a gif above to illustrate.
I suggest
- include the parent
div.form-field >
in the selector - exclude button
type
s, including submit, reset, etc.
#7
@
3 years ago
Per discussion with @peterwilsoncc, including the parent in the selector would force plugins/themes to follow the same pattern to take advantage of the form reset on submission. As there's currently many plugins making use of this feature, the safe thing to do here is to omit the parent selector.
However, the buttons do need to be accounted for. Updated patch incoming. Would appreciate some additional testing to make sure we've covered the default fields while also allowing for extenders to use the feature with their added fields/buttons.
Updated version that excludes radio buttons and checkboxes.