Skip to content

Separator Block: Apply default block variation when inserting via --- shortcut#77135

Open
BugReportOnWeb wants to merge 1 commit intoWordPress:trunkfrom
BugReportOnWeb:fix/separator-default-variation-input-transform
Open

Separator Block: Apply default block variation when inserting via --- shortcut#77135
BugReportOnWeb wants to merge 1 commit intoWordPress:trunkfrom
BugReportOnWeb:fix/separator-default-variation-input-transform

Conversation

@BugReportOnWeb
Copy link
Copy Markdown
Contributor

What?

Closes #75259

Apply default block variation attributes when creating a Separator block via the --- markdown shortcut.

Why?

When a default block variation is registered for the Separator block, it is correctly applied when inserting via the block inserter UI. But when inserting via the --- shortcut, it creates the Separator block with no attributes, so the default variation is never used and the block falls back to its hardcoded defaults.

How?

Updated the input transform to check the registered default variation for the Separator block before calling createBlock, and merge its attributes in.

If no default variation is registered, attributes falls back to an empty object and createBlock behaves exactly as before with no registered default variation.

Testing Instructions

  1. Register a default block variation for the Separator with tagName: 'div' (could use the snippet from the issue)
  2. Insert a Separator via the block inserter and observe it uses div
  3. Type --- to insert a Separator. Before the fix it uses hr, after the fix it correctly uses div.
  4. Remove the default variation registration and repeat step 3. Separator should still insert correctly with default hr behaviour.

Screenshots or screencast

Before After
Screenshot 2026-04-07 at 6 59 34 PM Screenshot 2026-04-08 at 1 57 32 PM

@github-actions github-actions bot added the [Package] Block library /packages/block-library label Apr 8, 2026
@BugReportOnWeb BugReportOnWeb marked this pull request as ready for review April 8, 2026 10:44
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 8, 2026

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: BugReportOnWeb <devasheeshkaul@git.wordpress.org>
Co-authored-by: Mustafabharmal <mustafabharmal@git.wordpress.org>
Co-authored-by: mrwweb <mrwweb@git.wordpress.org>

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] Separator Affects the Separator Block labels Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Block] Separator Affects the Separator Block [Feature] Block Transforms Block transforms from one block to another [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.

Separator block made with text expansion doesn't use default block variation

2 participants