Skip to content

fix: Fix accordion label inconsistency in stablecoins page #15471

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

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

chainide-agent-bob
Copy link
Contributor

Fix accordion label inconsistency in stablecoins page

Description

This PR fixes a state management issue in the StablecoinAccordion component where the "More/Less" labels weren't correctly updating when switching between accordion sections.

Problem

When a user clicks on an accordion section (like "Swap") and then clicks on another section (like "Buy"), the first section would collapse correctly but its label would remain as "Less" instead of switching back to "More". This created an inconsistent UI state where multiple collapsed sections could show "Less" labels simultaneously.

Solution

The solution centralizes the state management by:

  1. Adding a central openItem state in the parent StablecoinAccordion component to track which accordion item is currently open
  2. Modifying the AccordionCustomItem component to accept isOpen and onOpenChange props instead of managing state internally
  3. Ensuring that the "More/Less" label is correctly tied to the actual expanded/collapsed state of each section

This ensures that at most one accordion section can be expanded at any time, and the labels will always accurately reflect the current state of each section.

Fixes

#15398

Copy link

netlify bot commented May 19, 2025

Deploy Preview for ethereumorg ready!

Name Link
🔨 Latest commit 8fe0e7a
🔍 Latest deploy log https://app.netlify.com/projects/ethereumorg/deploys/682b0066798d380008241ce7
😎 Deploy Preview https://deploy-preview-15471--ethereumorg.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
7 paths audited
Performance: 47 (🔴 down 10 from production)
Accessibility: 95 (🟢 up 1 from production)
Best Practices: 89 (🔴 down 7 from production)
SEO: 98 (no change from production)
PWA: 59 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant