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

Split tabular numbers functionality out from the govuk-font mixin #3778

Closed
4 tasks done
Tracked by #2289
36degrees opened this issue Jun 9, 2023 · 0 comments · Fixed by #4307
Closed
4 tasks done
Tracked by #2289

Split tabular numbers functionality out from the govuk-font mixin #3778

36degrees opened this issue Jun 9, 2023 · 0 comments · Fixed by #4307
Assignees
Milestone

Comments

@36degrees
Copy link
Contributor

36degrees commented Jun 9, 2023

What

Introduce a new mixin that can be used to turn on typographic numbers without needing to call the govuk-font mixin.

Update any components that currently call govuk-font with $tabular: true to use the new mixin.

Update the govuk-font mixin to use the new mixin whilst maintaining the existing behaviour.

Optionally, we could also decide to deprecate (and in the future remove) the $tabular param on the govuk-font mixin and tell people to use the new mixin instead.

Why

The current implementation is an artefact of the way tabular numbers used to work when compatibility mode was enabled, when we had to switch out the font entirely rather than just switching some font variant settings:

@include govuk-typography-common($font-family: $govuk-font-family-tabular);

Because govuk-font includes govuk-typography-common, our current approach means that switching on tabular numbers also brings in all of the common typography declarations including the font-face, even when they are not required.

For example, the CSS for the govuk-table__cell--numeric modifier class currently looks like this:

.govuk-table__cell--numeric {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-font-feature-settings: "tnum" 1;
    font-feature-settings: "tnum" 1;
    font-family: GDS Transport,arial,sans-serif;
    font-weight: 400
}

@media print {
    .govuk-table__cell--numeric {
        font-family: sans-serif
    }
}

@supports (font-variant-numeric: tabular-nums) {
    .govuk-table__cell--numeric {
        -webkit-font-feature-settings:normal;
        font-feature-settings: normal;
        font-variant-numeric: tabular-nums
    }
}

When it could just look like this:

.govuk-table__cell--numeric {
    -webkit-font-feature-settings: "tnum" 1;
    font-feature-settings: "tnum" 1;
}

@supports (font-variant-numeric: tabular-nums) {
    .govuk-table__cell--numeric {
        -webkit-font-feature-settings:normal;
        font-feature-settings: normal;
        font-variant-numeric: tabular-nums
    }
}

Who needs to work on this

Developers

Who needs to review this

Developers

Done when

  • We've introduced a new mixin that can be used to turn on typographic numbers
  • We've updated any components that currently call govuk-font with $tabular: true to use the new mixin
  • We've updated the govuk-font mixin to use the new mixin whilst maintaining the existing behaviour
  • We've decided whether to deprecate the $tabular param on the govuk-font mixin
@36degrees 36degrees added this to the v5.x-candidate milestone Jun 9, 2023
@owenatgov owenatgov moved this from Backlog 🗄 to Sprint Backlog 🏃🏼‍♀️ in GOV.UK Design System cycle board Oct 2, 2023
@querkmachine querkmachine self-assigned this Oct 5, 2023
@querkmachine querkmachine moved this from Sprint Backlog 🏃🏼‍♀️ to In progress 📝 in GOV.UK Design System cycle board Oct 5, 2023
@querkmachine querkmachine moved this from In progress 📝 to Needs review 🔍 in GOV.UK Design System cycle board Oct 6, 2023
@owenatgov owenatgov modified the milestones: v5.x-candidate, v5.1 Oct 12, 2023
@owenatgov owenatgov moved this from Needs review 🔍 to Blocked ⛔ in GOV.UK Design System cycle board Oct 17, 2023
@owenatgov owenatgov moved this from Blocked ⛔ to Backlog 🗄 in GOV.UK Design System cycle board Nov 22, 2023
@owenatgov owenatgov moved this from Backlog 🗄 to Sprint Backlog 🏃🏼‍♀️ in GOV.UK Design System cycle board Dec 15, 2023
@querkmachine querkmachine moved this from Sprint Backlog 🏃🏼‍♀️ to Needs review 🔍 in GOV.UK Design System cycle board Dec 15, 2023
@querkmachine querkmachine moved this from Needs review 🔍 to Ready to release 🚀 in GOV.UK Design System cycle board Jan 5, 2024
@36degrees 36degrees moved this from Ready to release 🚀 to Done 🏁 in GOV.UK Design System cycle board Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging a pull request may close this issue.

3 participants