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

Include how to make accordion open by default #4331

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

samrwright
Copy link

Added content to explain how to make the sections open by default

Added content to explain how to make the sections open by default
Copy link

netlify bot commented Nov 25, 2024

You can preview this change here:

Built without sensitive environment variables

Name Link
🔨 Latest commit 1562b99
🔍 Latest deploy log https://app.netlify.com/sites/govuk-design-system-preview/deploys/6749814898f6e80008050132
😎 Deploy Preview https://deploy-preview-4331--govuk-design-system-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@matteason
Copy link
Contributor

matteason commented Nov 28, 2024

I don't think this behaviour is built into GOV.UK Frontend?

You can add the govuk-accordion__section--expanded class to the govuk-accordion__section div to default individual sections to open (https://github.com/alphagov/govuk-frontend/blob/1ac6988d3d9e83a1ee156a8483b6668f8a861cca/packages/govuk-frontend/src/govuk/components/accordion/template.njk#L6), or use the expanded option on an item in the Nunjucks templates, but I don't think there's anything special about the ID accordion-expanded which would trigger all sections to open.

Having a special ID triggering this behaviour would mean that you couldn't have multiple accordions defaulting to open and storing the section open state in a single service, because the ID is used as a key for the open state and has to be unique for each accordion

@samrwright
Copy link
Author

samrwright commented Nov 29, 2024 via email

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