Skip to content

Post Excerpt: Migrate to textAlign block support#75860

Merged
t-hamano merged 1 commit intoWordPress:trunkfrom
huzaifaalmesbah:update/post-excerpt-text-align
Mar 10, 2026
Merged

Post Excerpt: Migrate to textAlign block support#75860
t-hamano merged 1 commit intoWordPress:trunkfrom
huzaifaalmesbah:update/post-excerpt-text-align

Conversation

@huzaifaalmesbah
Copy link
Copy Markdown
Member

What?

Part of #60763

Migrates the Post Excerpt block to use the textAlign block support instead of a custom textAlign attribute. As a consequence, it also enables global styles support for textAlign on the Post Excerpt block.

Why?

The Post Excerpt block currently implements its own text alignment logic with a custom textAlign attribute and a manual AlignmentControl in the toolbar, duplicating code that should be handled by the centralized textAlign block support.

This migration reduces code duplication and consolidates alignment handling across blocks.

How?

  • Replaces the custom textAlign attribute and manual alignment logic with block supports.
  • Adds a deprecation entry to migrate existing blocks using the old textAlign attribute.
  • Fixes transforms to ensure alignment is preserved when converting between blocks.

Testing Instructions

  1. Create a new Post Excerpt block and test text alignment (left, center, right).
  2. Verify alignment works correctly in both the editor and the frontend.
  3. Open a post with existing Post Excerpt blocks that have alignment set.
  4. Verify they migrate correctly (no console errors, no visual changes).
  5. Confirm the block is valid after migration by checking there are no block validation warnings in the console.

Part of WordPress#60763

Migrates the Post Excerpt block to use the `textAlign` block support instead of a custom `textAlign` attribute. As a consequence, it also enables global styles support for `textAlign` on the Post Excerpt block.

Replaces the custom logic with the block supports and adds deprecation.
@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 24, 2026

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: huzaifaalmesbah <huzaifaalmesbah@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@t-hamano t-hamano added [Type] Code Quality Issues or PRs that relate to code quality [Block] Post Excerpt Affects the Post Excerpt Block [Type] Enhancement A suggestion for improvement. and removed [Type] Code Quality Issues or PRs that relate to code quality labels Mar 10, 2026
Copy link
Copy Markdown
Contributor

@t-hamano t-hamano 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 PR.

@t-hamano t-hamano added the props-bot Manually triggers Props Bot to ensure the list of props is up to date. label Mar 10, 2026
@github-actions github-actions bot removed the props-bot Manually triggers Props Bot to ensure the list of props is up to date. label Mar 10, 2026
@t-hamano t-hamano merged commit 049ab0e into WordPress:trunk Mar 10, 2026
57 of 61 checks passed
@github-actions github-actions bot added this to the Gutenberg 22.8 milestone Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Block] Post Excerpt Affects the Post Excerpt Block [Package] Block library /packages/block-library [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants