WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.52k stars 4.21k forks source link

Custom attributes for list block are lost when migrating from wordpress 5.5.1 to wordpress 6.1.1 #61457

Open kmrmohit opened 6 months ago

kmrmohit commented 6 months ago

Description

When upgrading from wordpress 5.5.1 to wordpress 6.1.1, the custom attributes defined for list block in wordpress 5 are not retained while migrating the list block.

Step-by-step reproduction instructions

  1. Run wordpress 6.1.1
  2. Open the code editor and paste the below html created for wp5 list blocks
    <!-- wp:list {"someCustomAttribute":["attrVal1","attrVal2]} -->
    <ul><li>first</li><li>second</li></ul>
    <!-- /wp:list -->
  3. Switch to visual editor and let wordpress create the blocks
  4. Open the code editor again and check for someCustomAttribute in the wp:list attributes, or open the console and execute below command wp.data.select('core/editor').getBlocks().attributes The code editor in wordpress 6 shows the below html and doesn't have the custom attribute anymore
    
    <!-- wp:list -->
    <ul><!-- wp:list-item -->
    <li>first</li>
    <!-- /wp:list-item -->
  • second
  • 
    
    ### Screenshots, screen recording, code snippet
    
    _No response_
    
    ### Environment info
    
    - Wordpress 6.1.1
    - Gutenberg 14.3.1
    - Chrome Version 124.0.6367.119 (Official Build) (arm64) 
    - macOS 14.3.1 (23D60)
    
    ### Please confirm that you have searched existing issues in the repo.
    
    Yes
    
    ### Please confirm that you have tested with all plugins deactivated except Gutenberg.
    
    Yes
    kmrmohit commented 6 months ago

    45987