#54296 closed defect (bug) (fixed)
Make sure the name does not contain spacing before creating the class
Reported by: | amustaque97 | Owned by: | audrasjb |
---|---|---|---|
Milestone: | 5.9 | Priority: | normal |
Severity: | minor | Version: | |
Component: | Editor | Keywords: | has-patch has-unit-tests commit |
Focuses: | css | Cc: |
Description
This was reported in https://wordpress.slack.com/archives/C02QB2JS7/p1629731076397000.
The process of generating a class for a style variation is not checking for spaces.
Step-by-step reproduction instructions
Add a style variation such as (note the spacing in the name):
<?php register_block_style( $block, array( 'label' => esc_html__( 'Style Name', 'slug' ), 'name' => 'style-class-1 style-class-2' ) );
When this style variation is selected by the user the CSS class attached to the block is
is-style-class-1 style-class-2
register_block_style function should return an error it doesn't contain spaces.
Change History (11)
This ticket was mentioned in PR #1777 on WordPress/wordpress-develop by amustaque97.
3 years ago
#1
- Keywords has-patch has-unit-tests added
This ticket was mentioned in PR #1777 on WordPress/wordpress-develop by amustaque97.
3 years ago
#2
Fixes #54296(trac issue, given link down below) originally it was reported in the Gutenberg repo issue #34242
In this commit, I have added a check inside the function if block style name
contain space it will trigger a notice and return false.
I have added a test case as well for this scenario
Trac ticket:
https://core.trac.wordpress.org/ticket/54296
This ticket was mentioned in Slack in #core-editor by amustaque97. View the logs.
3 years ago
#7
@
3 years ago
- Owner changed from amustaque97 to audrasjb
- Status changed from assigned to reviewing
Self assigning for final review then commit.
This ticket was mentioned in PR #1962 on WordPress/wordpress-develop by audrasjb.
3 years ago
#8
Trac ticket: https://core.trac.wordpress.org/ticket/54296
3 years ago
#10
Committer in https://core.trac.wordpress.org/changeset/52261
3 years ago
#11
Committed in https://core.trac.wordpress.org/changeset/52261
Fixes #54296(trac issue, given link down below) originally it was reported in the Gutenberg repo issue #34242
In this commit, I have added a check inside the function if block style name
contain space it will trigger a notice and return false.
I have added a test case as well for this scenario
Trac ticket:
https://core.trac.wordpress.org/ticket/54296