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

[Bug]: Spacing utility classes not behaving as expected #3444

Open
helenb opened this issue Dec 2, 2024 · 1 comment
Open

[Bug]: Spacing utility classes not behaving as expected #3444

helenb opened this issue Dec 2, 2024 · 1 comment
Labels
Bug Something isn't working Community backlog An issue raised on the community backlog High priority

Comments

@helenb
Copy link

helenb commented Dec 2, 2024

Describe the bug

I think I have found a bug with the spacing utility classes in the design system.

Given the following HTML

<h1 class="ons-u-fs-3xl ons-u-mb-2xl ons-u-mb-s@m">
    Analysis page
</h1>

I would expect that with the above code my h1 would have a bottom margin of 2.5rem, below the medium breakpoint, and a bottom margin of 1 rem above the medium breakpoint.

However, instead I see the following styles in the inspector when viewing the page at a larger breakpoint than 740px:

Screenshot 2024-12-02 at 10 23 21

I did wonder if I should be using one of the combination classes here, and searched the codebase for an example. I found for example the class ons-u-mt-l@2xs@m used in

<div class="ons-grid__col ons-col-4@m{{ ' ons-u-mt-l@2xs@m' if loop.index > 1 }}">
. This adds no margin-top styles at all, so I wonder if these are not working as expected?

Expected behaviour / outcome

<h1 class="ons-u-fs-3xl ons-u-mb-2xl ons-u-mb-s@m">
    Analysis page
</h1>

I would expect that with the above code my h1 would have a bottom margin of 2.5rem, below the medium breakpoint, and a bottom margin of 1 rem above the medium breakpoint.

<h1 class="ons-u-fs-3xl ons-u-mt-l@2xs@m">
    Analysis page
</h1>

I don't know exactly how this combination class is meant to work, but I expect it to add some margin-top styles, but instead no styles are applied.

List the steps necessary to reproduce the bug

I am seeing this bug when working on the https://github.com/ONSdigital/dis-wagtail repo, by applying the utility classes to any HTML in the codebase. This is using the design-system version 72.1.0. It should be repeatable in any repo using that version of the design system, by applying the relevant utility classes to some markup, and observing the resulting styles.

Additional context

No response

What version of the ONS Design System are you using?

72.1.0

What device(s) are you using?

Desktop

What operating system(s) are you using?

macOS

What browser(s) are you using?

Chrome

@helenb helenb added Bug Something isn't working Community backlog An issue raised on the community backlog High priority labels Dec 2, 2024
@MagdalenaLarge
Copy link

Hello @helenb , thank you for raising this issue. We will review this and come back to you as soon as possible. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Community backlog An issue raised on the community backlog High priority
Projects
None yet
Development

No branches or pull requests

2 participants