Skip to content

Conversation

@R1shabh-Gupta
Copy link
Contributor

@R1shabh-Gupta R1shabh-Gupta commented Sep 19, 2025

What?

Closes #71738

Hides the Icon Position setting when the Show icon toggle is turned off in the Accordion block.

Why?

When the Show icon setting is disabled, the Icon Position setting has no effect but was still visible in the inspector controls. This creates confusion for users as they see a setting that doesn't actually do anything when the icon is hidden.

How?

  • Added conditional rendering to only show the Icon Position setting when showIcon is true
  • Modified the Show icon toggle to reset iconPosition to the default value ('right') when the icon is disabled

Testing Instructions

  1. Open the WordPress editor (post or page)
  2. Insert an Accordion block
  3. Select the Accordion block to open the inspector controls
  4. In the Settings panel, you should see both "Show icon" and "Icon Position" settings
  5. Toggle the "Show icon" setting to OFF
  6. Verify that the "Icon Position" setting disappears from the panel
  7. Toggle the "Show icon" setting back to ON
  8. Verify that the "Icon Position" setting reappears and is set to "Right" (default)
  9. Change the "Icon Position" to "Left", then toggle "Show icon" OFF and back ON
  10. Verify that the position resets to "Right" when toggled back on

Screenshots or screencast

Before

Before.mov

After

After.mov

@R1shabh-Gupta R1shabh-Gupta marked this pull request as ready for review September 19, 2025 05:21
@github-actions
Copy link

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Type-related labels to choose from: [Type] Automated Testing, [Type] Breaking Change, [Type] Bug, [Type] Build Tooling, [Type] Code Quality, [Type] Copy, [Type] Developer Documentation, [Type] Enhancement, [Type] Experimental, [Type] Feature, [Type] New API, [Type] Task, [Type] Technical Prototype, [Type] Performance, [Type] Project Management, [Type] Regression, [Type] Security, [Type] WP Core Ticket, Backport from WordPress Core, Gutenberg Plugin, New Block.
  • Labels found: .

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

@github-actions
Copy link

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: R1shabh-Gupta <[email protected]>
Co-authored-by: t-hamano <[email protected]>

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.

LGTM 👍

@t-hamano t-hamano added [Type] Bug An existing feature does not function as intended [Block] Accordion Affects the Accordion Block labels Sep 19, 2025
@t-hamano t-hamano merged commit 5176cd1 into WordPress:trunk Sep 19, 2025
94 of 99 checks passed
@github-actions github-actions bot added this to the Gutenberg 21.8 milestone Sep 19, 2025
adamsilverstein pushed a commit to adamsilverstein/gutenberg that referenced this pull request Sep 22, 2025
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 [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: Hide Icon Position setting UI when Show icon setting is toggled off

2 participants