Skip to content
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

Add expanded option to accordion slots #115

Merged

Conversation

stevehook
Copy link
Contributor

I wanted to use the Accordion component to replace some long-hand markup in Find Teacher Training (https://github.com/DFE-Digital/find-teacher-training/blob/13f583cb053a5a7687465fccbb66200261b955f4/app/views/result_filters/subject/_form.html.erb#L10) and found that there was no way to specify an initially expanded section (slot). This PR is an attempt to add the option to the Accordion component's Slot sub-component.

I don't think this can be done simply by adding CSS class due the aria attribute needed on the heading so I've added an explicit expanded option here. There may be a simpler way!

One source of confusion (for me) was some JavaScript included in the design system that persists the expanded state of accordions in local storage. So if you've already viewed a page, toggled the expanded state and then revisit it whatever is in local storage overrides whatever the markup specifies.

Copy link
Member

@peteryates peteryates left a comment

Choose a reason for hiding this comment

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

Looks good to me 👍🏽

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.

2 participants