Skip to content

Details block: Add role attribute to summary #70124

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

Merged

Conversation

yogeshbhutkar
Copy link
Contributor

@yogeshbhutkar yogeshbhutkar commented May 15, 2025

What, Why, and How?

Part of #65778

This PR makes the Details block editable and visible in List View when within contentOnly mode, by assigning the content role to its summary attribute.

Testing Instructions

  1. Create a Group block and set the templateLock to contentOnly or copy the following HTML.
code
<!-- wp:group {"templateLock":"contentOnly","layout":{"type":"constrained"}} -->
<div class="wp-block-group"><!-- wp:details -->
<details class="wp-block-details"><summary>Details block example </summary><!-- wp:paragraph {"placeholder":"Type / to add a hidden block"} -->
<p>Example paragraph</p>
<!-- /wp:paragraph --></details>
<!-- /wp:details --></div>
<!-- /wp:group -->
  1. Confirm that the details block is visible in the list view.
  2. Confirm that the summary content can now be edited in contentOnly mode.

Testing Instructions for Keyboard

Same.

Screenshots

Before After
before-image after-image

Screencast

pr-demo.mov

@yogeshbhutkar yogeshbhutkar marked this pull request as ready for review May 15, 2025 04:49
Copy link

github-actions bot commented May 15, 2025

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: yogeshbhutkar <yogeshbhutkar@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>

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

Copy link
Contributor

@t-hamano t-hamano left a comment

Choose a reason for hiding this comment

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

I think this is a nice improvement.

Previously, in a Details block with contentOnly applied, clicking on the summary element didn't expand the content, so it was not possible to update the text in the inner block.

In this PR, not only will the summary text be editable, but the content can also be open, meaning that the text in the inner block can be changed as well.

@t-hamano t-hamano added [Type] Enhancement A suggestion for improvement. [Block] Details Affects the Details Block - used to display content which can be shown/hidden labels May 16, 2025
@t-hamano t-hamano added the props-bot Adding this label triggers the Props Bot workflow for a PR. label May 17, 2025
@github-actions github-actions bot removed the props-bot Adding this label triggers the Props Bot workflow for a PR. label May 17, 2025
@t-hamano t-hamano merged commit 2318147 into WordPress:trunk May 17, 2025
69 of 72 checks passed
@github-actions github-actions bot added this to the Gutenberg 20.9 milestone May 17, 2025
chriszarate pushed a commit to chriszarate/gutenberg that referenced this pull request Jul 1, 2025
Co-authored-by: yogeshbhutkar <yogeshbhutkar@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Details Affects the Details Block - used to display content which can be shown/hidden [Feature] Write mode [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants