Skip to content

Migrate pattern list item titles to Text from @wordpress/ui#77656

Open
kushagra-goyal-14 wants to merge 4 commits intoWordPress:trunkfrom
kushagra-goyal-14:refactor/migrate-experimantal-text-to-block-patterns-list
Open

Migrate pattern list item titles to Text from @wordpress/ui#77656
kushagra-goyal-14 wants to merge 4 commits intoWordPress:trunkfrom
kushagra-goyal-14:refactor/migrate-experimantal-text-to-block-patterns-list

Conversation

@kushagra-goyal-14
Copy link
Copy Markdown
Contributor

@kushagra-goyal-14 kushagra-goyal-14 commented Apr 24, 2026

What?

Part of: #77265

Migrates pattern list item titles in block-patterns-list/index.js from a <div> to the Text component from @wordpress/ui.


Why?

This change is part of the ongoing effort to standardize typography across the editor using shared primitives from @wordpress/ui. Replacing ad hoc elements with Text ensures consistency and alignment with the design system.


How?

  • Replaced <div className="block-editor-block-patterns-list__item-title"> with <Text>
  • Kept existing className to preserve styling
  • No additional layout or structural changes introduced

Testing Instructions

  1. Open the block editor:

    /wp-admin/post-new.php
    
  2. Open the Inserter (➕ button) and switch to the Patterns tab.

  3. Verify the following:

    • Pattern titles render correctly under each pattern preview
  4. Inspect the DOM


Screenshots

Before

Screenshot 2026-04-30 at 8 39 24 PM

After

Screenshot 2026-05-02 at 9 08 16 AM

Use of AI Tools

  • Used Copilot for PR description and commit messages

@github-actions github-actions Bot added the [Package] Block editor /packages/block-editor label Apr 24, 2026
@kushagra-goyal-14 kushagra-goyal-14 marked this pull request as ready for review April 24, 2026 16:42
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 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: kushagra-goyal-14 <kush123@git.wordpress.org>
Co-authored-by: ciampo <mciampini@git.wordpress.org>
Co-authored-by: jameskoster <jameskoster@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 the [Type] Enhancement A suggestion for improvement. label Apr 27, 2026
@simison simison requested review from aduth, ciampo and mirka April 30, 2026 12:25
@ciampo ciampo requested a review from jameskoster April 30, 2026 12:57
@ciampo
Copy link
Copy Markdown
Contributor

ciampo commented Apr 30, 2026

As mentioned in #77265 (comment), please update the PR description to include more details (especially around testing instructions) and a comprehensive before/after screenshots.

@kushagra-goyal-14
Copy link
Copy Markdown
Contributor Author

Hi @ciampo, I’ve updated the PR description to include detailed testing instructions and added a section for before/after screenshots.

Also, since the Text component renders a <span> by default, I used the render prop to pass a <div> so the original layout and styles remain unchanged. Let me know if you’d prefer sticking with the default element instead.

@jameskoster
Copy link
Copy Markdown
Contributor

From the “After” screenshot alone, I’m wondering why the height is 18.2px. Based on the body-md line-height and it being a block-level element, shouldn’t the rendered height be 20px?

@kushagra-goyal-14
Copy link
Copy Markdown
Contributor Author

From the “After” screenshot alone, I’m wondering why the height is 18.2px. Based on the body-md line-height and it being a block-level element, shouldn’t the rendered height be 20px?

@jameskoster, you’re right, as it looks like the issue was due to caching when I captured the earlier “after” screenshot, which is why the height appeared incorrect. Updated with a fresh one, and now it correctly reflects the applied changes (including the expected classes and styles).
Thanks for pointing that out!

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

Labels

[Package] Block editor /packages/block-editor [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants