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

Reduce border width of form inputs in the error state #1870

Merged
merged 4 commits into from
Jul 21, 2020

Commits on Jul 17, 2020

  1. Reduce border width of form inputs in error state

    We rely on the input border getting thicker when an input is focused [1] in order to meet WCAG 2.1 1.4.11: Non-text Contrast for the focus state. [2]
    
    However, when the text input or textarea is in the error state, it already has a thicker border, and so the border only changes from red to black (alongside the addition of the yellow outline). The contrast between the red and the black is only 2.75:1, so the change in state from error to focused may not be perceivable by some users.
    
    Reduce the error border width on inputs down to 2px, which is the same as the normal border width for a form input.
    
    As the border width is now no thicker than the normal border width, remove the overrides that suppress the focus state's box shadow from errored inputs.
    
    For components with multiple inputs, like the date input,this change does make it even more important to ensure that the error message clearly explains which field has the error. Although fields with an error continue to be differentiated from others by the thicker left border and the bold error text, the red border around the specific input can now only be seen as an enhancement. We are updating the documentation in the Design System to stress the importance of being explicit about which field an error message relates to. [3]
    
    [1]: https://design-system.service.gov.uk/get-started/focus-states/
    [2]: https://www.w3.org/TR/WCAG21/#non-text-contrast
    [3]: alphagov/govuk-design-system#1302
    Chris Thomas authored and 36degrees committed Jul 17, 2020
    Configuration menu
    Copy the full SHA
    6bdca06 View commit details
    Browse the repository at this point in the history
  2. Remove border from file upload error state

    Align the error state of the file input component to that of radios / checkboxes, where the error state is indicated by the red left-hand border on the form group and the error message.
    Chris Thomas authored and 36degrees committed Jul 17, 2020
    Configuration menu
    Copy the full SHA
    2bde81d View commit details
    Browse the repository at this point in the history
  3. Deprecate $govuk-border-width-form-element-error

    The border width of form elements in their error state (`$govuk-border-width-form-element-error`) is now the same as form elements in their normal state (`$govuk-border-width-form-element`) – both are 2px.
    
    This isn't something we think users need to be able to configure, and we don't really want the complexity of trying to support different border widths for the error state (for example, the box shadow override that we removed in 6bdca06 would need to be conditionally added if the user changed $govuk-border-width-form-element in order to maintain a consistent focus state).
    
    We'll remove this setting entirely in v4.0, the next breaking release.
    36degrees committed Jul 17, 2020
    Configuration menu
    Copy the full SHA
    e5e2b5b View commit details
    Browse the repository at this point in the history

Commits on Jul 21, 2020

  1. Document in changelog

    36degrees committed Jul 21, 2020
    Configuration menu
    Copy the full SHA
    891552c View commit details
    Browse the repository at this point in the history