-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes getColorClassName regression #32722
Conversation
…s it did with lodash kebabCase
Size Change: +711 B (0%) Total Size: 1.04 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prior to applying this PR and #32720 I could replicate the reported errors using the supplied block code. After applying these PRs the block was deemed valid.
There is just one small issue, the new regex doesn't allow hyphenated named color slugs e.g. subtle-background
. I'm not certain if there are any restrictions on these color slugs other than being passed through a safe attributes filter. Given they can be defined by theme developers through the theme.json, is the rigid regex here satisfactory?
I'll add a bit of unit test coverage. |
if ( 'string' !== typeof colorSlug ) { | ||
colorSlug = String( colorSlug ); | ||
// eslint-disable-next-line no-console | ||
console.warn( 'The color slug should be a string.' ); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What non-string value would be permissible here? Numbers, for example, don't seem to make sense here, do they?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as #32720 (comment) I think the issue is the same in both cases: that consumers of the API expected much more than we thought we offered. That there isn't a specific report yet doesn't mean there can't be some.
|
Updated the testing instructions to clarify how to have a subscription block available (still doing testing). |
We're reverting #32742 that caused the original issue. See also #32720 (comment) |
@nosolosw - did you want to keep this one open to circle back on this work, or will you open new PRs for the rework of this? Feel free to close it if not needed now. |
Description
The removal of lodash kebabCase from getColorClassName meant that special characters where not being stripped from the resulting classnames, so blocks that were passing in
#ffffff
as the color slug were expecting to seehas-ffffff-border-color
as the classname, but method is now returninghas-#ffffff-border-color
Fixes: #32721
Step-by-step reproduction instructions
npm install && npm run build:plugin-zip
and upload.Block should display as valid.