Skip to content

Fix Archives block alignment and custom class bugs#9696

Merged
youknowriad merged 1 commit intoWordPress:masterfrom
ZebulanStanphill:fix/archives-block-alignment-and-custom-classes
Sep 12, 2018
Merged

Fix Archives block alignment and custom class bugs#9696
youknowriad merged 1 commit intoWordPress:masterfrom
ZebulanStanphill:fix/archives-block-alignment-and-custom-classes

Conversation

@ZebulanStanphill
Copy link
Copy Markdown
Member

Description

This PR fixes two issues:

  • The Archives block uses an alignnone class when no alignment is set, which is inconsistent with other blocks.
  • Custom class names do not work with the Archives block.

It also contains some minor code cleanup, reorganizing attributes alphabetically and using Array.prototype.includes to check for valid alignments (which is something the Latest Comments block already does), rather than the more verbose and harder-to-read series of ||s.

@ZebulanStanphill
Copy link
Copy Markdown
Member Author

I can't figure out what is going wrong with the tests. Any ideas?

@ZebulanStanphill
Copy link
Copy Markdown
Member Author

Fixed the tests. Thanks for the help, @aduth! 🙂

@ZebulanStanphill
Copy link
Copy Markdown
Member Author

Squashed and rebased. Ready for review.

'align' => array(
'type' => 'string',
),
'className' => array(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not certain declaring this one is necessary here because there's a hook adding this attribute. Though one could think the hook is only declared on JavaScript which means nothing guarantees that it's available in PHP (which hopefully the server-side awareness work should resolve)

Copy link
Copy Markdown
Contributor

@youknowriad youknowriad left a comment

Choose a reason for hiding this comment

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

LGTM 👍 Thanks for the tweaks

@youknowriad youknowriad added this to the 3.9 milestone Sep 12, 2018
@youknowriad youknowriad added the [Feature] Blocks Overall functionality of blocks label Sep 12, 2018
@youknowriad youknowriad merged commit 77ff8e6 into WordPress:master Sep 12, 2018
@ZebulanStanphill ZebulanStanphill deleted the fix/archives-block-alignment-and-custom-classes branch September 12, 2018 13:03
@bartclaeys
Copy link
Copy Markdown

I am still having trouble with the image block. <figure> class alignnone is not being applied. Neither wp-caption-text on <figcaption>. For backward compatibility, these classes should be added.

screen shot 2018-11-05 at 2 32 08 pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Blocks Overall functionality of blocks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants