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

New errors and validation guidance for review #71

Merged
merged 20 commits into from
Jun 1, 2015

Conversation

gemmaleigh
Copy link
Contributor

There has been rather a lot of back-and-forth in the previous PR while this was tested further.
This is a new clean branch with the proposed changes to the errors and validation section.

It can be previewed here: https://govuk-elements-test.herokuapp.com/

Our current thinking about validation messages is:

  • encourage the use of error summary boxes, as close to the top of the main content as possible
  • provide a link to correct each error within the summary box
  • error text must sit within either the label or legend for the question it relates to, to ensure it is read out by Assistive Technology

There are two example pages, one which shows how to display errors for a single question - a group of radio buttons and another which shows how to display errors for multiple questions. They have additional implementation advice underneath each example.

In both cases a summary box has been used and the wording is generic, to discourage these examples being copied verbatim. The words used as error messages in the examples show how the messages should differ, however, the exact wording used for error messages is outside the scope of this pull request.

gov uk elements - errors

gov uk the best place to find government services and information - example 1
gov uk the best place to find government services and information - example 3

gemmaleigh added 12 commits May 14, 2015 11:45
- Update guidance to match the Hackpad
- Show two examples, one with radio buttons and one with multiple
questions
- Fix incorrect IDs for alpha and beta banner content
Two examples - one with radio buttons, one with two form fields
These are the same as the example snippets, but with the error messages
always visible.
These show how to mark up error messages for a form with a single
question - with radio buttons and for a form with multiple questions, a
text input and date of birth field.
If there is an error summary, set focus to the summary - otherwise,
set focus to the first input (to cover both text input and radios or
checkboxes)
Add new .lead-in class for paragraphs above lists
- New darker error colour (awaiting update to front-end toolkit)
- Left hand border on error messages
- Error messages are indented by 10px for smaller screens and 15px for
tablet and up
- Only add spacing under block labels
- Remove spacing for the last item
- Add box-sizing to .form-group to prevent content wider than 100%
- Make all form labels the same size (19px)
- Adjust the spacing for elements in-between form elements
- Remove the spacing under .form-hint
@edwardhorsford
Copy link
Contributor

Gemma - these are excellent. After using these on passports for our last user research session, I'm pleased. The warnings are very clear.

Would be good to follow up at some point with validation for inset / conditional questions.

Gemma Leigh added 2 commits May 14, 2015 18:10
- Make sure there is 15px between the form question and the input or
group of radio buttons
- Keep this spacing the same when an error message is shown
- Fix indent on legend for IE7 and below
This was causing spacing issues.

Move .form-label-bold class to inner span.
This gives more consistent styling cross-browser.

Also update other examples for consistency.
@stevenaproctor
Copy link

A few questions...

  1. Are we saying there should be a summary box on all screens - even those with a single question? What would this mean when the anchor is already visible on the screen?
  2. Should the summary box outline be the full measure of the wrapper? None of its content will be.
  3. Can we have two H1s? Whether it is against WCAG or not, how does it affect users that use the headings to navigate the page?
  4. Would having a ul in the summary box that has hidden bullet points and a capital letter at the beginning infringe GOV.UK list style? Or would this be an accepted style for summary boxes?

Full name

<span class="form-hint">As shown on your birth certificate or passport</span>
<span class="error-message" id="error-full-name">Error message about full name goes here</span>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're linking to the input text error message here, but for the radio button example you've linked to the legend, https://github.com/alphagov/govuk_elements/blob/new-errors-and-validation-guidance-for-review/views/snippets/form_error_radio.html#L31. Is this intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @gavboulton,

No, that was a mistake.

I've added the missing aria-describedby attributes and the link is now (and should be) to the label, in the same way as the radio button example links to the legend.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @gemmaleigh,
This is looking really good.

Rather than styling legends, apply the .form-label-bold class to a span
wrapping the label legend text.
The aria-describedby attribute should go on the <input>, because it’s
the thing being “described” by the additional/error information. Ensure
this association exists for both examples.
…b.com:alphagov/govuk_elements into new-errors-and-validation-guidance-for-review
line 14: Opening curly brace `{` should be preceded by one space
line 96: @include declaration should be preceded by an empty line
@robmckinnon
Copy link

@gemmaleigh When are you expecting this PR to be merged?

We are keen to re-use your new errors css in ministryofjustice/defence-request-service.

@gemmaleigh
Copy link
Contributor Author

Hi @robmckinnon, apologies - I've been away. It'll be merged later today.

@stevenaproctor
Copy link

@gemmaleigh

The descriptive link for an incorrect National Insurance number in the example with multiple error messages doesn't work.

The link points at an id (error-ni-number) that either isn't there (only one error is made) or incorrect (error-full-name when there are two errors).

@gemmaleigh
Copy link
Contributor Author

@saproctor thanks for pointing that out, those examples have now been updated.

@gemmaleigh
Copy link
Contributor Author

@saproctor

  1. Yes, this is the best method we've found for users of Assistive Technology.
  2. The summary box should be the full width of its container.
  3. If it is found that using headings in this way causes a problem, the examples will be revised. For now, they reflect that the most important heading on the page - once an error has been made - is the heading in the summary box.
  4. Yes, this is the agreed style for summary boxes. I've spoken to Beck Thompson and the Content Style Guide will be updated to note the differences for lists within summary boxes.

gemmaleigh added a commit that referenced this pull request Jun 1, 2015
…ce-for-review

New errors and validation guidance
@gemmaleigh gemmaleigh merged commit 281fb6b into master Jun 1, 2015
quis added a commit to Crown-Commercial-Service/digitalmarketplace-frontend-toolkit that referenced this pull request Jun 23, 2015
This commit is built on top of the work and research that @gemmaleigh did
towards
alphagov/govuk_elements#71

It changes two main things:
- the borders and spacing of validation errors
- the nesting of markup to put the error message and hint inside the question's
  `label` or `legend`

It does not address:
- The language we use in the validation 'masthead', ie just refering users to
  which questions have errors, rather than explaining why the error occured
  (this is a more comprehensive change that would need to happen across all of
  our apps)
@gemmaleigh gemmaleigh deleted the new-errors-and-validation-guidance-for-review branch August 4, 2015 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants