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

Better handle cases where govuk-text-colour is set to a non-colour value #2573

Merged
merged 7 commits into from
Mar 28, 2022

Commits on Mar 13, 2022

  1. Reinstate support for 'inherit' as a text colour

    The use of the `rgba` function, which was added to work around a bug in
    Safari, prevents users from setting `$rgba-text-colour` to inherit.
    This is useful if you wish to control the text colour by cascading a
    style down from, say, a body tag, which in turn is useful in order to
    apply this control at run-time rather than build-time.
    
    This fixes the problem by first testing for the value `inherit`. When
    found we simply evaluate to `inherit`, which is probably the best we
    can do in the circumstance. When it is not found we apply the `rgba`
    trick.
    daniel-ac-martin authored Mar 13, 2022
    Configuration menu
    Copy the full SHA
    68de55c View commit details
    Browse the repository at this point in the history
  2. Add some tests for govuk-link-style-text mixin

    Adds some tests for the reinstated support for `inherit` as a
    `$govuk-text-colour` in the `govuk-link-style-text` mixin.
    daniel-ac-martin committed Mar 13, 2022
    Configuration menu
    Copy the full SHA
    cc5e134 View commit details
    Browse the repository at this point in the history

Commits on Mar 14, 2022

  1. Test for type rather than specific value

    We wish to defend against passing `rgba()` a value that is not a colour, such as is the case with `inherit`.
    
    Rather than testing for `inherit` specifically it is better to just test the type of the variable to see whether it is a colour or not.
    
    We can also avoid setting the `:hover` state entirely which should reduce the size of the resulting CSS.
    
    (Thanks to @36degrees for this suggestion.)
    
    Co-authored-by: Oliver Byford <[email protected]>
    daniel-ac-martin and 36degrees authored Mar 14, 2022
    Configuration menu
    Copy the full SHA
    1b047c9 View commit details
    Browse the repository at this point in the history
  2. Update test to reflect lack of a :hover state

    The last commit optimised the code to remove the `:hover` state when it
    isn't required, therefore we must no longer test for its presence.
    daniel-ac-martin committed Mar 14, 2022
    Configuration menu
    Copy the full SHA
    d212ec1 View commit details
    Browse the repository at this point in the history

Commits on Mar 17, 2022

  1. Add fix to changelog

    daniel-ac-martin committed Mar 17, 2022
    Configuration menu
    Copy the full SHA
    34de34a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    6d80a53 View commit details
    Browse the repository at this point in the history

Commits on Mar 28, 2022

  1. Configuration menu
    Copy the full SHA
    5718240 View commit details
    Browse the repository at this point in the history