close
Skip to content

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

Merged
mirka merged 7 commits into
WordPress:trunkfrom
kushagra-goyal-14:refactor/migrate-experimantal-text-to-block-patterns-list
May 14, 2026
Merged

Migrate pattern list item titles to Text from @wordpress/ui#77656
mirka merged 7 commits into
WordPress: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: mirka <0mirka00@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!

<div className="block-editor-block-patterns-list__item-title">
<Text
render={ <div /> }
className="block-editor-block-patterns-list__item-title"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this an ad hoc override, or a redundant font size style, or is the Text variant wrong?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for catching that @mirka . I checked both variants:

body-sm: 12px font-size, 16px line-height, removes CSS override entirely.

body-md: would require keeping the CSS override, with 20px line-height.

Since the original font styling was effectively 12px and the original height of the div was 18.2px, I am leaning towards body-sm for a clean look. Please share your thoughts if that works.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yes, that makes sense.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks, made the changes.

@kushagra-goyal-14 kushagra-goyal-14 requested a review from mirka May 7, 2026 12:38
Copy link
Copy Markdown
Member

@mirka mirka left a comment

Choose a reason for hiding this comment

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

Looks good to go 👍

@mirka mirka merged commit dc5e2ec into WordPress:trunk May 14, 2026
40 checks passed
@github-actions github-actions Bot added this to the Gutenberg 23.3 milestone May 14, 2026
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.

5 participants