Skip to content

Conversation

@snehapatil2001
Copy link
Contributor

@snehapatil2001 snehapatil2001 commented Dec 6, 2024

Resolves #67619

What?

This PR ensures that styling, such as fontSize, textColor and backGround, is preserved when transforming a block into a List block. Previously, these styles were lost when transforming the block.

Why?

This PR addresses the issue and ensures that the styles are carried over, improving the block transformation experience.

How?

  • The logic in block-library/src/list/transforms.js has been updated to capture the attributes from blocks during transformation.
  • These attributes are then retained when transforming into a List block, preventing the styling loss.

Testing Instructions

  1. Open the block editor in Gutenberg.
  2. Add a Paragraph block and apply typography styles (e.g., font size, text color).
  3. Transform the Paragraph block into a Heading block and verify that the styles are preserved.
  4. Revert the Heading block back to the Paragraph block and ensure the styles remain.
  5. Transform the Paragraph block into a List block and confirm the styles carry over.
  6. Revert the List block back to a Paragraph block and verify the original styles are maintained.

Testing Instructions for Keyboard

  • Use the Tab key to navigate and select the Paragraph block.
  • Apply styles using the block toolbar.
  • Transform the block using the block options menu and verify the styling persists in the List block.
  • Use the keyboard to navigate between blocks and check that styles are correctly preserved.

video

Screen.Recording.2024-12-06.at.4.35.59.PM.mov

@github-actions
Copy link

github-actions bot commented Dec 6, 2024

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: snehapatil2001 <[email protected]>

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

@Mamaduka Mamaduka added [Type] Bug An existing feature does not function as intended [Feature] Block Transforms Block transforms from one block to another [Block] List Affects the List Block labels Jan 13, 2025
@t-hamano
Copy link
Contributor

t-hamano commented Dec 8, 2025

Sorry for the late review.I think this issue needs to be addressed in a more abstract way rather than in specific blocks.
See #73821 for more details.

I'd like to close this issue, but thanks for your contribution!

@t-hamano t-hamano closed this Dec 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Block] List Affects the List Block [Feature] Block Transforms Block transforms from one block to another [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Block Transform Feature : Doesn't preserves styling with List block

3 participants