Skip to content

Cover/Accordion: Exit on Enter#77301

Open
ocean90 wants to merge 2 commits into
WordPress:trunkfrom
wearerequired:fix/exit-on-enter-accordion
Open

Cover/Accordion: Exit on Enter#77301
ocean90 wants to merge 2 commits into
WordPress:trunkfrom
wearerequired:fix/exit-on-enter-accordion

Conversation

@ocean90

@ocean90 ocean90 commented Apr 14, 2026

Copy link
Copy Markdown
Member

What?

Closes #77294.

This PR adds the __experimentalOnEnter support key like done in 223baa2 and already used by other blocks: https://github.com/search?q=repo%3AWordPress%2Fgutenberg+__experimentalOnEnter+language%3AJSON&type=code&l=JSON

Why?

It solves the problem of not be able to exit the block by pressing enter, it only adds empty paragraphs.

How?

Adding __experimentalOnEnter to supports config in block.json.

Testing Instructions

  1. Add a Cover block
  2. Select a color and enter some text for the first paragraph
  3. Click enter twice

Testing Instructions for Keyboard

Screenshots or screencast

Bildschirmaufnahme.2026-04-14.um.11.08.53.mov

Use of AI Tools

None.

@ocean90 ocean90 requested a review from ellatrix April 14, 2026 09:20
@github-actions github-actions Bot added the [Package] Block library /packages/block-library label Apr 14, 2026
@github-actions

github-actions Bot commented Apr 14, 2026

Copy link
Copy Markdown

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: ocean90 <ocean90@git.wordpress.org>
Co-authored-by: jasmussen <joen@git.wordpress.org>
Co-authored-by: krokodok <krokodok@git.wordpress.org>

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

@ocean90 ocean90 added [Type] Bug An existing feature does not function as intended [Block] Cover Affects the Cover Block - used to display content laid over a background image [Block] Accordion Affects the Accordion Block labels Apr 14, 2026
@ocean90

ocean90 commented May 11, 2026

Copy link
Copy Markdown
Member Author

@ellatrix Do you think adding __experimentalOnEnter for these blocks is also a good idea?

@ocean90 ocean90 requested review from Mamaduka and jasmussen June 11, 2026 10:19
@jasmussen

Copy link
Copy Markdown
Contributor

Thanks for the PR, thanks for the ping. It can be hard to keep up with everything, appreciate your patience; if you find a PR stuck in the future, consider pinging also @WordPress/gutenberg-design, for gut-checks. The group can often expand ping ranges too, if need be.

In this case, I agree with the change. It's very simple, uses an existing (if private) API, and it solves a reasonable problem. There isn't really a compelling layout you can achieve with empty linebreaks (that without spaces inside collapse on the frontend anyway). On the other hand, this change fixes a problem where if the only block you've inserted is a cover block, you can't exit it with keyboard only (in part introduced in #76568). With this PR, you can.

@jasmussen jasmussen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Tentative green light. I'd appreciate a second voice before you merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Block] Accordion Affects the Accordion Block [Block] Cover Affects the Cover Block - used to display content laid over a background image [Package] Block library /packages/block-library [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Accordion Block: Pressing Enter in empty Paragraph should exit Accordion Panel

2 participants