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 open attribute to component wrapper #4074

Merged
merged 1 commit into from
Jun 24, 2024
Merged

Add open attribute to component wrapper #4074

merged 1 commit into from
Jun 24, 2024

Conversation

andysellick
Copy link
Contributor

What

  • adds the ability to pass an open attribute to the component wrapper helper
  • needed for the details component, where open can be passed as true to have the details component expanded by default

Why

Originally done as part of #4068 but that PR is huge enough without this additional change, so I'm separating them out.

Visual Changes

None.

Trello card: https://trello.com/c/rNPqwDIr/188-remove-ua-code-from-components-gem

@govuk-ci govuk-ci temporarily deployed to components-gem-pr-4074 June 24, 2024 09:53 Inactive
@andysellick andysellick requested a review from AshGDS June 24, 2024 09:58
Copy link
Contributor

@AshGDS AshGDS 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 👍

According to MDN, setting open to false will open the details component:

Note: You have to remove this attribute entirely to make the details hidden. open="false" makes the details visible because this attribute is Boolean.

Unless I'm misreading the code, does this need to be reflected in this PR? I can see that in your "can set an open attribute, overriding a passed value" test the open attribute is nil after you set the value to false, so maybe you've already accounted for this?

@andysellick
Copy link
Contributor Author

Good point @AshGDS thanks. Have added an explicit test to check this, do you think that covers this?

- adds the ability to pass an open attribute to the component wrapper helper
- needed for the details component, where open can be passed as true to have the details component expanded by default
@govuk-ci govuk-ci temporarily deployed to components-gem-pr-4074 June 24, 2024 11:20 Inactive
Copy link
Contributor

@AshGDS AshGDS left a comment

Choose a reason for hiding this comment

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

Thanks, looks good 👍

@andysellick
Copy link
Contributor Author

Thanks @AshGDS

@andysellick andysellick merged commit 8cf48de into main Jun 24, 2024
11 checks passed
@andysellick andysellick deleted the cw-open branch June 24, 2024 12:35
@MartinJJones MartinJJones mentioned this pull request Jun 26, 2024
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.

3 participants