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

Fix custom attributes on lists with one item #3333

Merged
merged 3 commits into from
Sep 10, 2024

Conversation

rmccar
Copy link
Contributor

@rmccar rmccar commented Sep 10, 2024

What is the context of this PR?

Fixes: #3332

This PR updates the list macro to set custom attributes on the correct elements when you have a list with only one item that is a link.

Added comment as reminder for next breaking change to list component

How to review this PR

  • Test the correct attributes are set using these configurations:
{% from "components/list/_macro.njk" import onsList %}
{{
    onsList({
        "element": "ol",
        "attributes": {
            "data-qa": "error-list"
        },
        "itemsList": [
            {
                "url": '#0',
                "text": 'Who we are',
                "attributes": {
                    "data-qa": "error-list-1"
                }
            }
        ]
    })
}}
{% from "components/list/_macro.njk" import onsList %}
{{
    onsList({
        "element": "ol",
        "attributes": {
            "data-qa": "error-list"
        },
        "itemsList": [
            {
                "url": '#0',
                "text": 'Who we are'
            }
        ]
    })
}}
  • Test other configurations with more than one item in the list with and without setting the url param on the items

Checklist

This needs to be completed by the person raising the PR.

  • I have selected the correct Assignee
  • I have linked the correct Issue

Copy link

netlify bot commented Sep 10, 2024

Deploy Preview for ons-design-system-preview ready!

Name Link
🔨 Latest commit 2b9adba
🔍 Latest deploy log https://app.netlify.com/sites/ons-design-system-preview/deploys/66e007319374550008f44f03
😎 Deploy Preview https://deploy-preview-3333--ons-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.

@rmccar rmccar changed the title fix list custom attributes only one item url Fix list custom attributes only one item url Sep 10, 2024
@rmccar rmccar added the Bug Something isn't working label Sep 10, 2024
@rmccar rmccar self-assigned this Sep 10, 2024
@rmccar rmccar requested a review from a team September 10, 2024 08:38
@rmccar rmccar changed the title Fix list custom attributes only one item url Fix custom attributes on lists with one item Sep 10, 2024
@rmccar rmccar merged commit 78227f4 into main Sep 10, 2024
12 checks passed
@rmccar rmccar deleted the fix-list-custom-attributes-only-one-item-url branch September 10, 2024 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: List custom attributes not working as expected
3 participants