Skip to content

Migrate accordion #2721

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 9 commits into
base: main
Choose a base branch
from
Open

Migrate accordion #2721

wants to merge 9 commits into from

Conversation

GraceGardner
Copy link
Contributor

@GraceGardner GraceGardner commented May 12, 2025

Description & motivation 💭

Migrate accordion and accordion group to runes mode.

Note: the team has decided to leave the Accordion Light component and files using it in legacy mode for now. Will no longer be using this component in the future.

Screenshots (if applicable) 📸

Design Considerations 🎨

Testing 🧪

How was this tested 👻

  • Manual testing
  • E2E tests added
  • Unit tests added

Steps for others to test: 🚶🏽‍♂️🚶🏽‍♀️

Checklists

Draft Checklist

Merge Checklist

Issue(s) closed

DT-2938

Docs

Any docs updates needed?

Copy link

vercel bot commented May 12, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
holocene ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 10, 2025 8:29pm

Comment on lines +75 to +76
onclick={(e) => e.stopPropagation()}
onkeyup={(e) => e.stopPropagation()}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this will break anywhere we're using click or keyup handlers like <Accordion on:click={doSomething} />. The old syntax was forwarding the listener down to this div element, this new syntax is just calling stopPropagation(), but doesn't account for if an onclick or onkeyup callback function is passed to Accordion.

Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure about this spot, but rather than stopping propagation, I tend to preventDefault. It sort of marks it as handled, so up the chain, a handler can check if (e.defaultPrevented).

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh ya know what, I read stopPropagation as preventDefault hah, so I think this is totally fine. I think we were getting double click events or something when a custom action was passed in, hence why the stopPropagation directives were added.

Copy link
Contributor Author

@GraceGardner GraceGardner Jun 10, 2025

Choose a reason for hiding this comment

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

@rossedfort Tested this by adding an alert in an onclick event and it seems to be working fine. I left the alert on the first accordion in storybook if you want to check?

Copy link
Contributor

Choose a reason for hiding this comment

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

@GraceGardner I tested and it seems to be working. Let's remove the alert before merging though. Instead, we can add action('onclick')

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do, thanks Ross

Copy link
Contributor

@andrewzamojc andrewzamojc left a comment

Choose a reason for hiding this comment

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

Cool stuff! I left some comments.

open: { control: 'boolean' },
expandable: { control: 'boolean' },
error: { control: 'text' },
icon: { control: 'select', options: iconNames },
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment: Storybook might set up most of these automatically now with Meta<AccordionProps>.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm a bit less sure about this one... Let me know what you think we should do here or if you have any docs that are helpful pointing me in the right direction.

Copy link
Contributor

@andrewzamojc andrewzamojc Jun 12, 2025

Choose a reason for hiding this comment

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

No change needed:

No worries. This is a sidetrack and doesn't need to be considered in this PR. For interest sake or future work, I found this bit on storybook choosing controls automatically https://storybook.js.org/docs/essentials/controls#choosing-the-control-type

Copy link
Contributor

@andrewzamojc andrewzamojc left a comment

Choose a reason for hiding this comment

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

LGTM

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.

4 participants