Skip to content

Conversation

@theminaldiwan
Copy link
Contributor

What?

Closes #71806

Why?

When collapsed panel and we added already padding, border or box-shadow to panel then its appearance not looks proper.

How?

Using style hide the visibility of panel when it is collapsed.
or we can apply (Dimensions) and (Border & Shadow) inline styles to child element of wp-block-accordion-panel

Testing Instructions

  • Insert an Accordion block
  • Apply padding and border styles to the Accordion Header block.
  • Open the front end.

Screencast

Screen.Recording.2025-09-23.at.6.34.55.PM.mov

@github-actions
Copy link

github-actions bot commented Sep 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.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @minaldiwan.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Unlinked contributors: minaldiwan.

Co-authored-by: theminaldiwan <[email protected]>
Co-authored-by: t-hamano <[email protected]>
Co-authored-by: shail-mehta <[email protected]>

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] Bug An existing feature does not function as intended [Block] Accordion Affects the Accordion Block labels Sep 24, 2025
@t-hamano
Copy link
Contributor

@theminaldiwan, I think this PR is the same as #71845, and I can see conflicts in this PR. You'll probably need to sync your local repository with the upstream branch before submitting a PR.

@theminaldiwan
Copy link
Contributor Author

Yes @t-hamano
By mistake I closed #71845 this PR and unable to reopen it.
That's why create new PR.

@shail-mehta
Copy link
Member

@theminaldiwan Thanks for the PR.

This PR also have Conflicts. Could you please resolve this Conflicts?

@theminaldiwan theminaldiwan force-pushed the fix/accordion-panel-visibility-issue branch from b853e78 to 3b2cf23 Compare September 24, 2025 10:53
@t-hamano
Copy link
Contributor

How about updating packages/block-library/src/accordion-panel/style.scss as follows?

.wp-block-accordion-panel {
	&[inert],
	&[aria-hidden="true"] {
		display: none;
		// Prevent blockGap from Accordion Content block from adding extra margin between accordions.
		margin-block-start: 0;
	}
}

That is, remove overflow-hidden and add display:none. [inert] or [aria-hiddne="true"] is a selector used to apply styles when the panel is not visually visible.

@theminaldiwan
Copy link
Contributor Author

Hi @t-hamano

How about updating packages/block-library/src/accordion-panel/style.scss as follows?

.wp-block-accordion-panel {
	&[inert],
	&[aria-hidden="true"] {
		display: none;
		// Prevent blockGap from Accordion Content block from adding extra margin between accordions.
		margin-block-start: 0;
	}
}

That is, remove overflow-hidden and add display:none. [inert] or [aria-hiddne="true"] is a selector used to apply styles when the panel is not visually visible.

I update style in latest commit.

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 merged commit 8650614 into WordPress:trunk Sep 26, 2025
68 checks passed
@github-actions github-actions bot added this to the Gutenberg 21.8 milestone Sep 26, 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 Panel: Block should not be visible when the panel is collapsed

4 participants