Fix pattern category renaming causing potential duplicate categories#55607
Fix pattern category renaming causing potential duplicate categories#55607
Conversation
|
This PR has string updates, so won't be something that can be backported to WordPress 6.4. We might want to consider porting it to a minor version. We could also make a version of this PR that has no string updates that's backportable to 6.4. |
aaronrobertshaw
left a comment
There was a problem hiding this comment.
Thanks for the fix here @talldan 👍
It tests as advertised for me and the addition of spoken messages for screen readers is greatly appreciated.
We could use a snackbar, but it might be better to show some inline text below the input?
I'm not sure on the best option here. I'd be inclined to see what some inline text might look like as the snackbar notices appear to be beneath the modal's background overlay.
|
Size Change: +399 B (0%) Total Size: 1.7 MB
ℹ️ View Unchanged
|
55a6ad7 to
356d24f
Compare
|
I've updated this to show a visual message as well as the spoken message. I've followed the guidance for inline errors from the webaim site - https://webaim.org/techniques/formvalidation/. |
…55607) * Check for existing categories when renaming to avoid creating a duplicate * Add a spoken message when a renaming errors occur * Convert to lowercase before comparison * Clear validation messages when entering new text * Improve styling of validation message # Conflicts: # packages/edit-site/src/components/page-patterns/rename-category-menu-item.js # packages/patterns/src/components/rename-pattern-category-modal.js
|
I just cherry-picked this PR to the 6.4-next-point-release branch to get it included in the next release: 56b1b0f |
…55607) * Check for existing categories when renaming to avoid creating a duplicate * Add a spoken message when a renaming errors occur * Convert to lowercase before comparison * Clear validation messages when entering new text * Improve styling of validation message # Conflicts: # packages/edit-site/src/components/page-patterns/rename-category-menu-item.js # packages/patterns/src/components/rename-pattern-category-modal.js
What?
Fixes #55564
As described in #55564, it's possible to create duplicate patten categories when renaming a category.
This PR should prevent that happening.
Why?
Duplicates are undesirable. Users should instead reassign a pattern to the category with the existing name.
How?
Check existing categories prior to renaming. If a match is found, avoid renaming and show an error below the input.
I have added a spoken message for screenreader users.
Testing Instructions
Testing Instructions for Keyboard
Prerequisite - you need an existing custom pattern category.
Screenshots or screencast
Kapture.2023-10-31.at.00.11.29.mp4