diff --git a/packages/govuk-frontend/src/govuk/helpers/_typography.scss b/packages/govuk-frontend/src/govuk/helpers/_typography.scss index 276de07966..f546eee62e 100644 --- a/packages/govuk-frontend/src/govuk/helpers/_typography.scss +++ b/packages/govuk-frontend/src/govuk/helpers/_typography.scss @@ -160,6 +160,11 @@ // deprecated sizes used internally, for example `govuk-font($size: "_14")` $size-internal-use-only: str-slice(#{$size}, 1, 1) == "_"; + // Remove underscore from font sizes flagged for internal use + @if $size-internal-use-only { + $size: str-slice(#{$size}, 2); + } + // Check for a font map exactly matching the given size $font-map: map-get($govuk-typography-scale, $size); diff --git a/packages/govuk-frontend/src/govuk/overrides/_typography.scss b/packages/govuk-frontend/src/govuk/overrides/_typography.scss index 9a02349cdd..836ca3f39c 100644 --- a/packages/govuk-frontend/src/govuk/overrides/_typography.scss +++ b/packages/govuk-frontend/src/govuk/overrides/_typography.scss @@ -6,19 +6,15 @@ // // govuk-!-font-size-14 is deprecated @each $size, $font-map in $govuk-typography-scale { - // Suppress class if the map key is a string with an underscore eg: _14 to - // avoid classes like govuk-!-font-size-_14 getting generated - @if type-of($size) == "number" or str-slice(#{$size}, 1, 1) != "_" { - .govuk-\!-font-size-#{$size} { - $font-map: map-get($govuk-typography-scale, $size); + .govuk-\!-font-size-#{$size} { + $font-map: map-get($govuk-typography-scale, $size); - // Add underscore to deprecated typography scale keys - @if map-has-key($font-map, "deprecation") { - $size: _#{$size}; - } - - @include govuk-font-size($size, $important: true); + // Add underscore to deprecated typography scale keys + @if map-has-key($font-map, "deprecation") { + $size: _#{$size}; } + + @include govuk-font-size($size, $important: true); } } diff --git a/packages/govuk-frontend/src/govuk/settings/_typography-responsive.scss b/packages/govuk-frontend/src/govuk/settings/_typography-responsive.scss index c096e66bfc..42e54aa4bc 100644 --- a/packages/govuk-frontend/src/govuk/settings/_typography-responsive.scss +++ b/packages/govuk-frontend/src/govuk/settings/_typography-responsive.scss @@ -157,19 +157,5 @@ $govuk-typography-scale: ( message: "14 on the type scale is deprecated and will be removed as " + "a possible option in the next major version." ) - ), - _14: ( - null: ( - font-size: 12px, - line-height: 15px - ), - tablet: ( - font-size: 14px, - line-height: 20px - ), - print: ( - font-size: 12pt, - line-height: 1.2 - ) ) ) !default;