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(components): ensure that custom attributes get a space inserted before each one #338

Merged
merged 1 commit into from
Mar 31, 2022

Conversation

ushkarev
Copy link
Contributor

@ushkarev ushkarev commented Mar 29, 2022

Identify the bug

Almost all MoJ design system components do not put correct whitespace around custom attributes in the nunjucks template.

For instance, https://github.com/ministryofjustice/hmpps-incentives-ui/blob/b8892793247cad8af2c2494802ce839e3abdaf99/server/views/pages/analytics/graph-layout.njk#L5-L24 renders as:

<nav class="moj-sub-navigation govuk-!-display-none-print" aria-label="Incentive data navigation">
  <ul class="moj-sub-navigation__list">
    <li class="moj-sub-navigation__item">
      <a class="moj-sub-navigation__link" aria-current="page" href="/analytics/incentive-levels"data-qa="incentive-levels">Incentive levels</a>
    </li>
    <li class="moj-sub-navigation__item">
      <a class="moj-sub-navigation__link"  href="/analytics/behaviour-entries"data-qa="behaviour-entries">Behaviour entries</a>
    </li>
    <li class="moj-sub-navigation__item">
      <a class="moj-sub-navigation__link"  href="/analytics/protected-characteristics"data-qa="protected-characteristics">Protected characteristics</a>
    </li>
  </ul>
</nav>

…note the absence of a space before each of the data-qa attributes.

Description of the change

This fix removes the nunjucks whitespace stripping before each custom attribute.

Possible drawbacks

If some service's tests have been written to expect this even though it's incorrect HTML.

Release notes

Ensured that custom attributes get a space inserted before each one

@ushkarev ushkarev requested a review from a team as a code owner March 29, 2022 19:55
@ushkarev ushkarev force-pushed the fix-custom-attributes branch from 4c417a1 to 2b16360 Compare March 31, 2022 14:52
@ushkarev ushkarev merged commit 9720222 into main Mar 31, 2022
@ushkarev ushkarev deleted the fix-custom-attributes branch March 31, 2022 14:59
@gregtyler
Copy link
Contributor

🎉 This PR is included in version 1.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants