Skip to content

Conversation

@R1shabh-Gupta
Copy link
Contributor

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

What?

Closes #71437

Fixes the accordion toggle button overflow issue when the accordion block is set to full width alignment.

Why?

When an Accordion block is set to full width and the Accordion Header is clicked to expand the panel, the rotated toggle button element overflows horizontally, causing an unwanted horizontal scrollbar to appear. This creates a poor user experience and visual inconsistency.

The issue was occurring because the accordion heading container didn't have proper overflow handling for the rotated toggle icon.

How?

Added overflow-x: hidden to the .accordion-content__toggle CSS selector. This prevents the rotated toggle button from causing horizontal overflow while maintaining the visual rotation effect.

Testing Instructions

  1. Open a post or page in the editor
  2. Insert an Accordion block
  3. Select the accordion block and set its alignment to "Full width" using the alignment controls in the toolbar
  4. Save and view the post on the frontend
  5. Click on the Accordion Header to expand/collapse the panel
  6. Verify that no horizontal scrollbar appears when the toggle button rotates

Screenshots or screencast

Before

Before

After

After

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.

Thanks for the PR

I think adding the overflow-x: hidden to the header will cause the outline to disappear when the header button is focused.

It's a good idea to use the .accordion-content__toggle selector.

@t-hamano t-hamano added [Type] Bug An existing feature does not function as intended [Block] Accordion Affects the Accordion Block labels Sep 2, 2025
@R1shabh-Gupta R1shabh-Gupta marked this pull request as ready for review September 2, 2025 03:18
@github-actions
Copy link

github-actions bot commented Sep 2, 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: R1shabh-Gupta <rishabhwp@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.

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 95b580e into WordPress:trunk Sep 2, 2025
73 checks passed
@github-actions github-actions bot added this to the Gutenberg 21.6 milestone Sep 2, 2025
Copy link

@vinay070403 vinay070403 left a comment

Choose a reason for hiding this comment

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

The E2E test site-editor-url-navigation.spec.js is failing on GitHub Actions at line 44 due to a TimeoutError. Playwright cannot find or click the button For a specific item within 10s.
Possible reasons: the button is not rendered yet, the selector changed, or CI is slower than local.
Next steps: review the button’s presence, consider increasing timeout, or add waitFor before clicking to ensure stability.

@t-hamano
Copy link
Contributor

t-hamano commented Sep 2, 2025

@vinay070403 The instability of the E2E tests is completely unrelated to this PR.

@mikachan
Copy link
Member

mikachan commented Sep 3, 2025

👋 It looks like this is causing a vertical scrollbar on the accordion header:

Editor:
image

Front end:
image

Maybe we need to use overflow: hidden instead?

@t-hamano
Copy link
Contributor

t-hamano commented Sep 3, 2025

@mikachan Thanks for noticing!

Maybe we need to use overflow: hidden instead?

Yes, this seems to be the best approach.

@R1shabh-Gupta
Copy link
Contributor Author

Sorry, I’m not sure how I missed it. Let me double-check. Should I create a new PR with the fix and reference this PR in it?

@mikachan
Copy link
Member

mikachan commented Sep 3, 2025

Sorry, I’m not sure how I missed it. Let me double-check. Should I create a new PR with the fix and reference this PR in it?

No problem at all. A new PR with a reference to this one sounds good!

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: Toggle button may overflow

4 participants