Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renaming UI doesn't work for some blocks #57954

Closed
3 tasks done
t-hamano opened this issue Jan 18, 2024 · 8 comments · Fixed by #58296
Closed
3 tasks done

Renaming UI doesn't work for some blocks #57954

t-hamano opened this issue Jan 18, 2024 · 8 comments · Fixed by #58296
Assignees
Labels
[Block] Image Affects the Image Block [Block] More Affects the More Block - used for displaying the 'Read More' link [Block] Submenu Affects the Submenu Block - for submenus in navigation [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended [Type] Tracking Issue Tactical breakdown of efforts across the codebase and/or tied to Overview issues.

Comments

@t-hamano
Copy link
Contributor

t-hamano commented Jan 18, 2024

What problem does this address?

Renaming UI is now available for almost all blocks. However, in some blocks where __experimentalLabel is opted in, I found that the label entered in this UI is not reflected in the list view.

For example, a paragraph block returns a custom label if the context is list-view.

if ( context === 'list-view' && customName ) {
return customName;
}

On the other hand, in the Image block, there is no process to return a custom label in the case of list-view context.

What is your proposed solution?

We need to resolve this issue in blocks that have opted in to __experimentalLabel and where supports.renaming is not false in block.json.

As far as I've researched, the problem needs to be resolved in the following blocks:

On the other hand, we shouldn't need to do anything with the following blocks.

  • ✅ Heading (core/heading): Works correctly
  • ✅ Paragraph (core/paragraph): Works correctly
  • ⚠️ Page List Item (core/page-list-item): This is the child block when you insert the Page List block. It will be displayed in the list view, but when you click on the block, a modal will be displayed to convert it to a link. Since the block sidebar cannot be operated, there is virtually no need to fix it.
  • ⚠️ Unsupported (core/missing): If a block is broken, nothing will be displayed in the block sidebar. Therefore, there is virtually no need to fix it.
@t-hamano t-hamano added [Type] Enhancement A suggestion for improvement. [Type] Bug An existing feature does not function as intended [Type] Tracking Issue Tactical breakdown of efforts across the codebase and/or tied to Overview issues. [Block] Image Affects the Image Block [Block] More Affects the More Block - used for displaying the 'Read More' link [Block] Submenu Affects the Submenu Block - for submenus in navigation and removed [Type] Enhancement A suggestion for improvement. labels Jan 18, 2024
@annezazu
Copy link
Contributor

@getdave as a heads up based on your work here. Adding this to 6.5.

@getdave
Copy link
Contributor

getdave commented Jan 25, 2024

@t-hamano Thank you for spotting these and following up.

@merijnponzo
Copy link

merijnponzo commented Mar 1, 2024

Does this already work with custom blocks?

I added

 "renaming": true,

To my custom block.json within the block.json support object
I also added:

 "metadata":{
      "type": "object",
      "default": {
        "name": "Test"
      }
    }

to my block.json attributes object but no rename field shows up.

Only when i add :

"__experimentalMetadata": true

to my block.json i see the name field when selecting my block, but the name doesn't appear in the list view

Thank you

@getdave
Copy link
Contributor

getdave commented Mar 1, 2024

@merijnponzo Could you please post information about how you are testing this? For example is the Gutenberg Plugin enable (version) and which version of WP. Many thanks

@merijnponzo
Copy link

@getdave sorry i can confirm this works with 6.5
Since i'm using worpdress Bedrock i realised i was still testing with 6.4 so i copied the files manually and now it works

without using:

 "__experimentalBlockRenaming":true,
    "__experimentalMetadata":true

and only

"renaming": true

I am not sure if i still have to add:

"metadata":{
      "type": "object",
      "default": {
        "name": "Test"
      }
    }

To my block.json

Great work!

@getdave
Copy link
Contributor

getdave commented Mar 1, 2024

By default all blocks have renaming support so you shouldn't need to do anything.

Please see #54426 (comment).

@dannyreaktiv
Copy link

dannyreaktiv commented Mar 6, 2024

For a custom block, I was using just "renaming": true in 6.4, and now it isn't working in 6.4.3. Is there any more documentation I could look at?

Update Same code does work in 6.5 RC1… guess I just gotta wait a little bit.

@t-hamano
Copy link
Contributor Author

t-hamano commented Mar 6, 2024

@dannyreaktiv

Rename support varies by WordPress version.

  • WP6.4: Only group block supports renaming. The rename UI is displayed for all blocks, this is an unintended bug.
  • WP6.4.3: The rename UI that was displayed unintentionally has been fixed. (#55995)
  • WP6.5: Most core blocks and custom blocks support renaming UI. Rename defaults to true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Image Affects the Image Block [Block] More Affects the More Block - used for displaying the 'Read More' link [Block] Submenu Affects the Submenu Block - for submenus in navigation [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended [Type] Tracking Issue Tactical breakdown of efforts across the codebase and/or tied to Overview issues.
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

5 participants