Skip to content

Background panel: Remove unused props #70573

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

Conversation

shimotmk
Copy link
Contributor

What?

Background panel: Remove unused props

toggleProps has properties className and aria-expanded.

const toggleProps = {
onClick: onToggle,
className:
'block-editor-global-styles-background-panel__dropdown-toggle',
'aria-expanded': isOpen,
'aria-label': __(
'Background size, position and repeat options.'
),
isOpen,
};

Therefore, className will be overwritten. block-editor-global-styles-background-panel__image-preview will not be rendered.

aria-expanded is a redundant property and does not need to be present.

<Button
__next40pxDefaultSize
className={ className }
{ ...restToggleProps }
aria-expanded={ isOpen }
>
{ renderPreviewContent() }
</Button>

Why?

This eliminates duplicate props and makes the code cleaner.

Testing Instructions for Keyboard

Confirmed the background controls such as group blocks work as they did before.

Screenshots or screencast

There is no difference in the rendered code.

Before After
before after

@shimotmk shimotmk requested a review from ellatrix as a code owner June 30, 2025 22:57
Copy link

github-actions bot commented Jun 30, 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: shimotmk <shimotomoki@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.

@t-hamano t-hamano added [Type] Code Quality Issues or PRs that relate to code quality [Package] Block editor /packages/block-editor labels Jul 1, 2025
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.

LGTM!

@t-hamano t-hamano added the props-bot Adding this label triggers the Props Bot workflow for a PR. label Jul 1, 2025
@github-actions github-actions bot removed the props-bot Adding this label triggers the Props Bot workflow for a PR. label Jul 1, 2025
@t-hamano t-hamano merged commit 7ea45c1 into WordPress:trunk Jul 1, 2025
110 of 113 checks passed
@github-actions github-actions bot added this to the Gutenberg 21.2 milestone Jul 1, 2025
@shimotmk shimotmk deleted the quality/background-panel-remove-unused-props branch July 1, 2025 04:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Block editor /packages/block-editor [Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants