#42937 closed defect (bug) (fixed)
Success Message should display on insertion of new category in Taxonomy page
Reported by: | manishamakhija | Owned by: | joedolson |
---|---|---|---|
Milestone: | 5.9 | Priority: | normal |
Severity: | normal | Version: | 4.9.1 |
Component: | Taxonomy | Keywords: | has-patch has-screenshots has-unit-tests input-validation commit |
Focuses: | ui, accessibility, administration | Cc: |
Description
When we add new category then apart from displaying a new category at the top, there should also display a success message like 'new category added successfully' same as we have in 'Add new post' Page.
https://www.awesomescreenshot.com/image/3050291/30f92b69674d681274d708ec6d6e472b
https://www.awesomescreenshot.com/image/3050289/1e5164792645bf217b32b93d2f33e2bc
Attachments (13)
Change History (52)
#2
@
7 years ago
Hi @manishamakhija, welcome to WordPress trac.
This looks like a good improvement, I recall adding tags/categories and not being sure if it was added or not.
I noticed that the following string in 42937.patch is not translatable:
$message = 'New '. $tax->labels->singular_name . ' created successfully';
Suggestion:
$message = sprintf( __( 'New %s created successfully.' ), $tax->labels->singular_name );
#3
@
7 years ago
- Focuses ui added
- Keywords has-screenshots added
@manishamakhija I uploaded your screenshots here above, to avoid them being lost if the image hosting changes.
#6
@
7 years ago
I have made changes to existing .patch to improve coding standard.
- Whitespace found at end of line
- Expected 1 space before/after closing bracket.
- if/else/for/while/try blocks should always use braces
#7
@
6 years ago
Need for this new enhancement:
In one of my project when I was entering new term in category, it doesn't show at the top/first position though it is added in the backend which displays after page refresh. For more clarification see video I've attached in it. So it's better if we can add success message too.
#8
@
6 years ago
I had another look at this and I would suggest we limit the scope of the ticket to the existing "added" messages. We can see the existing messages here:
https://core.trac.wordpress.org/browser/tags/4.9.5/src/wp-admin/includes/edit-tag-messages.php
There are only three variations for "added":
- Category added.
- Tag added.
- Item added.
where the last one is for a taxonomy that's neither a category
or a post_tag
.
I also think we should have the "added" ajax admin notice dismissable.
Usually that's done via CSS classes like: notice is-dismissible
.
But that's not triggered here via ajax. I think a workaround for that is to trigger the 'wp-updates-notice-added'
event.
42937.3.diff is a suggested patch that:
- Adds a message according to the three existing variations, mentioned above.
- Adds CSS classes to the admin notice.
- Makes the admin notice dismissable, by triggering the
'wp-updates-notice-added'
event.
Todo:
- Find a way to use the translated strings from the
$messages
array and make the ajax "added" message filterable byterm_updated_messages
.
Further:
- If we want to modify the "added" message, then I think a new ticket would serve it better.
- I wonder if the "deleted" message should be considered too? (If so then in another ticket).
#9
@
6 years ago
In 42937.4.diff is a suggested way to:
- Reuse the translated strings from the
$messages
array (i.e. with index 3). - Allow the message to be filterable with
term_updated_messages
.
#11
@
6 years ago
I find this issue with all taxonomies including tags, product categories in WooCommerce or Custom Taxonomies. This really gets difficult when you already have a lot of taxonomy and you have to search for where your addition was added.
other than the message stating which category was added I would suggest like when a category gets deleted that row is highlighted in red the newly added taxonomy is highlighter in green.
#12
@
5 years ago
- Milestone changed from Awaiting Review to 5.3
- Owner set to SergeyBiryukov
- Status changed from new to reviewing
#15
@
5 years ago
Thanks everyone for this ticket, patch, and feedback. I'd like to propose a further improvement: when a new term gets created, there's no feedback at all for screen readers. A simple wp.a11y.speak()
message would be great, using the same already existing strings for categories, tags, and custom taxonomies:
'Category added.' / 'Tag added.' / 'Term added.'
It would be great to add a speak()
message also when terms are deleted :)
This ticket was mentioned in Slack in #accessibility by audrasjb. View the logs.
5 years ago
This ticket was mentioned in Slack in #accessibility by audrasjb. View the logs.
5 years ago
#18
@
5 years ago
- Type changed from enhancement to defect (bug)
Discussed during today's accessibility bug scrub. Agreed to change this ticket from "enhancement" to "bug" as the lack of proper feedback is an accessibility bug.
This ticket was mentioned in Slack in #accessibility by audrasjb. View the logs.
5 years ago
This ticket was mentioned in Slack in #accessibility by audrasjb. View the logs.
5 years ago
#21
@
5 years ago
- Keywords needs-refresh added
- Milestone changed from 5.3 to Future Release
This ticket is not going to be ready for WP 5.3 since it still needs a new patch and testing.
Moving from 5.3 to Future release.
This ticket was mentioned in Slack in #accessibility by joedolson. View the logs.
3 years ago
#23
@
3 years ago
- Milestone changed from Future Release to 5.9
- Owner changed from SergeyBiryukov to joedolson
This ticket was mentioned in Slack in #accessibility by ryokuhi. View the logs.
3 years ago
#25
@
3 years ago
- Keywords needs-refresh removed
Updated this patch:
- Added wp.a11y.speak on errors and success message
- Switched from index 3 (Term updated) to index 1 (Term added), as that's the more appropriate message
- updated unit tests
I don't have a deep familiarity with the WP unit test suite, so somebody should check this over.
#26
follow-up:
↓ 28
@
3 years ago
@hellofromTonya Can you check over these tests? I updated them, but I don't have sufficient comfort with the test suite to be confident.
#28
in reply to:
↑ 26
@
3 years ago
Replying to joedolson:
@hellofromTonya Can you check over these tests? I updated them, but I don't have sufficient comfort with the test suite to be confident.
Sure Joe, happy to help. I'll likely combine the patch and tests to create a PR. Then it run in CI against all the supported PHP versions and gain the extra static checks too.
Adding to my TODO.
This ticket was mentioned in PR #1884 on WordPress/wordpress-develop by hellofromtonya.
3 years ago
#29
- Applies patch 42937.5.diff
- Applies and updates AddTag.php
Trac ticket: https://core.trac.wordpress.org/ticket/42937
#30
@
3 years ago
@joedolson PR 1884 combines the 2 patches and updates the unit tests. Should be ready.
@
3 years ago
Test Report: Test before applying PR 1884 patch. No success message. Confirmed reported issue.
@
3 years ago
Test Report: Test after applying PR 1884 patch. Success message displays as expected ✅
#31
@
3 years ago
- Keywords commit added; needs-testing removed
Test Report
Env:
- OS: macOS Big Sur
- WordPress: latest
trunk
(5.9-alpha) - Browsers: Chrome, Firefox, Edge, and Safari
- Plugins: none
- Theme: TT2
- localhost: wp-env
Steps
- Go to Posts > Categories
- Add a new category by typing a name into the
Name
field - Press enter, return, or "Add New Category" button.
Expected behavior:
- Category is added
- A success message "Category added" displays
- Repeat but attempt to add a category that already exists.
Expected behavior:
- Category is not added
- An error message displays: "A term with the name provided already exists with this parent."
Test Results
- Able to reproduce reported issue ❌. See 42937-before.gif.
- After applying the patch and repeating steps 1-3, success message displays as expected ✅. See 42937-test-after-pr1884-applied.gif.
- Step 4 displays an error message as expected before and after patch is applied. No regression introduced ✅
Marking for commit.
hellofromtonya commented on PR #1884:
3 years ago
#35
Committed via https://core.trac.wordpress.org/changeset/52168.
I have added patch for this ticket