[wp-trac] [WordPress Trac] #47018: No error message provided upon incomplete input in Tags Administration Screen
WordPress Trac
noreply at wordpress.org
Fri Mar 18 15:06:25 UTC 2022
#47018: No error message provided upon incomplete input in Tags Administration
Screen
-------------------------------------+-------------------------------------
Reporter: conner_bw | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Future Release
Component: Taxonomy | Version: 5.1.1
Severity: normal | Resolution:
Keywords: has-screenshots input- | Focuses: ui, accessibility,
validation | administration
-------------------------------------+-------------------------------------
Comment (by afercia):
Looking back into this, seems to me there's some some parts of the related
code are pretty old and maybe some overlap has occurred over time, which
is perfectly understandable in a so large project with lots of legacy ode.
In `src/js/_enqueues/admin/tags.js`:
- When submitting the form, `window.validateForm` is called to check
whether the 'Name' input field is empty.
- If it's empty, the code in `tags.js` returns false. thus preventing the
Ajax call and the form submission.
Actually, this prevents the 'add tag' Ajax action from doing its job.
Seems everything we need is already there:
- The Ajax response properly returns success or error messages.
- `window.wpAjax` parses the response and appends the messages at the top
of the page.
- There are already audible messages for screen readers via
`wp.a11y.speak`.
- The form submission is already prevented.
All the above doesn't run just because of the `return false` in `tags.js`.
I do realize the current code 'saves' one Ajax request when the field is
empty but that comes at the cost of missing feedback for users.
Removing the `return false` does allow the Ajax request to run and return
the error messages. Seems to me this would be more inline with the
purpose of the existing Ajax response.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/47018#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list