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 documentation for 'id' to accordion component #3789

Merged
merged 1 commit into from
May 24, 2024

Conversation

patrickpatrickpatrick
Copy link
Contributor

@patrickpatrickpatrick patrickpatrickpatrick commented May 9, 2024

What

Add extra documentation for the 'id' attribute to the 'How It Works' section of the accordion component.

Why

if a user is just using the HTML of the accordion component, then they might not encounter the additional documentation provided for the 'id' attribute. This addresses issue #1073.

Copy link

netlify bot commented May 9, 2024

You can preview this change here:

Name Link
🔨 Latest commit e01cb50
🔍 Latest deploy log https://app.netlify.com/sites/govuk-design-system-preview/deploys/6644863433d46e000862448e
😎 Deploy Preview https://deploy-preview-3789--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.

@patrickpatrickpatrick patrickpatrickpatrick requested a review from a team May 9, 2024 12:57
@@ -65,6 +65,8 @@ There are 2 ways to use the accordion component. You can use HTML or, if you’r

The accordion component uses JavaScript. When JavaScript is not available, users will see all the content displayed with the section labels as headings.

The 'id' attribute on the the parent div of the accordion is a required attribute. It must be unique across the domain of your service to persist the expanded state of the accordion (the state individual instances of the component persists across page loads using [session storage](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage)).
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to make this into the active voice without changing its meaning? For example - You'll require the 'id' attribute from the parent div of the accordion.
Also, I'm unclear what you mean in the last sentence in brackets.

Suggested change
The 'id' attribute on the the parent div of the accordion is a required attribute. It must be unique across the domain of your service to persist the expanded state of the accordion (the state individual instances of the component persists across page loads using [session storage](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage)).
The 'id' attribute on the the parent div of the accordion is a required attribute. It must be unique across the service's domain to maintain the persistent expanded state of the accordion (the state individual instances of the component persists across page loads using [session storage](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage)).

@@ -65,6 +65,8 @@ There are 2 ways to use the accordion component. You can use HTML or, if you’r

The accordion component uses JavaScript. When JavaScript is not available, users will see all the content displayed with the section labels as headings.

If you are using HTML, you must add an 'id' attribute to the parent div of the accordion. It must be unique across the service's domain to maintain the persistent expanded state of the accordion
Copy link
Contributor

Choose a reason for hiding this comment

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

This is great. To be a nuisance, could you add a full stop, please?

@@ -65,6 +65,8 @@ There are 2 ways to use the accordion component. You can use HTML or, if you’r

The accordion component uses JavaScript. When JavaScript is not available, users will see all the content displayed with the section labels as headings.

If you are using HTML, you must add an 'id' attribute to the parent div of the accordion. It must be unique across the service's domain to maintain the persistent expanded state of the accordion.
Copy link
Member

Choose a reason for hiding this comment

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

suggestion That last one reads nicely 🙌🏻 Wondering if talking about 'parent div' may cause some confusion and lead to people to place that id on a <div> wrapping the accordion, rather than the one with the class="accordion" attribute. I would propose to clarify with either:

Suggested change
If you are using HTML, you must add an 'id' attribute to the parent div of the accordion. It must be unique across the service's domain to maintain the persistent expanded state of the accordion.
If you are using HTML, you must add an 'id' attribute to the root `<div>` tag of the accordion. It must be unique across the service's domain to maintain the persistent expanded state of the accordion.

or

Suggested change
If you are using HTML, you must add an 'id' attribute to the parent div of the accordion. It must be unique across the service's domain to maintain the persistent expanded state of the accordion.
If you are using HTML, you must add an 'id' attribute to the `<div>` tag with the `accordion` class. It must be unique across the service's domain to maintain the persistent expanded state of the accordion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That makes sense!

The extra documentation for the 'id' attribute that was present in the
Nunjucks options table for the accordion has been added to the 'How It
Works Section'. This is because if a user is just using the HTML of the
accordion component, then they might not encounter the additional
documentation provided for the 'id' attribute.

This addresses issue #1073.
Copy link
Member

@romaricpascal romaricpascal 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 that last update! ⛵

@patrickpatrickpatrick patrickpatrickpatrick merged commit a2df741 into main May 24, 2024
13 checks passed
@patrickpatrickpatrick patrickpatrickpatrick deleted the add-documentation-for-accordion branch May 24, 2024 08:43
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.

Accordion HTML version doesn't state that IDs need to be unique
3 participants