Skip to content

UI: Remove shorthand prop options from Box component#73529

Merged
aduth merged 1 commit intotrunkfrom
remove/box-shorthand-props
Nov 25, 2025
Merged

UI: Remove shorthand prop options from Box component#73529
aduth merged 1 commit intotrunkfrom
remove/box-shorthand-props

Conversation

@aduth
Copy link
Member

@aduth aduth commented Nov 24, 2025

What?

Follow-up to feedback at #72984 (comment)

Removes shorthand prop p=, bg=, fg= alternatives to long-form equivalents padding=, backgroundColor=, color= props.

This could be reevaluated in the future if aliasing proves beneficial.

Why?

Per feedback at #72984 (comment) :

  • Adds complexity when doing any kind of AST analysis or modification (e.g. lint rules, codemods, prop usage stats).
  • Has a learning curve for humans who see the shorthand for the first time.
  • Consistency concerns within a single file will subtly add to the cognitive load ("which prop version should I use here?") and affect searchability.
  • Adds noise to documentation.
  • Subtle bugs when both the canonical prop and alias prop are added mistakenly with different values.

Per #72984 (comment) :

in reflecting on how the idea with shorthands is often to enable "power users" to have a more expressive APIs, that's not really very considerate of the people who end up maintaining said "power users" code down the line, who may benefit from the more verbose alternative and the consistency of having a consistent way of interacting with these components

Testing Instructions

Repeat Testing Instructions from #72984, verifying no regressions.

@aduth aduth requested a review from mirka November 24, 2025 21:10
@aduth aduth requested a review from a team as a code owner November 24, 2025 21:10
@github-actions
Copy link

github-actions bot commented Nov 24, 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: aduth <[email protected]>
Co-authored-by: juanfra <[email protected]>

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

@aduth aduth added [Type] Task Issues or PRs that have been broken down into an individual action to take [Package] UI /packages/ui labels Nov 24, 2025
@github-actions
Copy link

Flaky tests detected in 8022d4c.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/19649346422
📝 Reported issues:

Copy link
Member

@juanfra juanfra left a comment

Choose a reason for hiding this comment

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

LGTM

revert-box-shorthand.mp4

@aduth aduth merged commit 4956690 into trunk Nov 25, 2025
41 of 43 checks passed
@aduth aduth deleted the remove/box-shorthand-props branch November 25, 2025 19:43
@github-actions github-actions bot added this to the Gutenberg 22.2 milestone Nov 25, 2025
@bph bph added the [Type] Enhancement A suggestion for improvement. label Nov 26, 2025
@t-hamano t-hamano removed the [Type] Enhancement A suggestion for improvement. label Nov 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] UI /packages/ui [Type] Task Issues or PRs that have been broken down into an individual action to take

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants