Skip to content
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

Search block: remove double spaces #41746

Merged
merged 3 commits into from
Jun 15, 2022
Merged

Conversation

scruffian
Copy link
Contributor

What?

Removes double spaces from the class names in the Search block. Fixes #41608

Why?

Not sure!

How?

Makes $block_classes an array, not a string so they can be output using implode.

Testing Instructions

  • Add the search block to a post
  • Check the markup of the block and ensure there's only one space between each class name.

Copy link
Member

@dmsnell dmsnell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really like the change and the move towards a data model that more closely reflects the reality of what we're dealing with.

Apart from removing the var_dump() this looks like a good simple patch to apply.

One alternative we could have also explored (and maybe you did) is leave the concatenation the way it was but do a syntactic cleanup where we're currently implode()ing:

esc_attr( preg_replace( '~\s+~', ' ', $button_classes ) )

packages/block-library/src/search/index.php Outdated Show resolved Hide resolved
@scruffian
Copy link
Contributor Author

One alternative we could have also explored (and maybe you did) is leave the concatenation the way it was but do a syntactic cleanup where we're currently implode()ing:

The reason I prefer the array is that, as you say, it represents "a data model that more closely reflects the reality of what we're dealing with."!

Copy link
Member

@dmsnell dmsnell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All clear!

@scruffian scruffian merged commit cc6ed98 into trunk Jun 15, 2022
@scruffian scruffian deleted the fix/double-spaces-in-search-block branch June 15, 2022 22:36
@github-actions github-actions bot added this to the Gutenberg 13.6 milestone Jun 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extra spaces in search block / button markup
2 participants