-
Notifications
You must be signed in to change notification settings - Fork 332
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
Consider updating hints and error messages to use paragraphs #2083
Comments
One consideration – we often see very long hints that are made up of multiple paragraphs, or include lists – so we might need to either keep hints as divs or make them configurable to support either a single paragraph or a div wrapper. However, there are other issues with very long hints – they're associated with the input using So, another alternative would be to be more restrictive about the sort of content that can go into a hint and provide an alternative pattern for cases where longer guidance is needed alongside a form input. |
As discussed as part of our v4 prioritising, we should make sure:
We should remember that we can always tackle the error messages and hint text separately if we're more confident of one change than another. |
I’ve tested with Voiceover, NVDA and JAWS, comparing our current implementation ( It feels pretty low risk to make this change for error messages. We know that hints are slightly more complex, as we did make a change previously from Next StepsIf we agree that we want to use paragraphs for both hints and error messages, the next steps:
|
We've decided to go ahead and make the change for error messages. The change to hints needs a little more research as it'll block users from adding any block level elements to the hint. Generally we think this is ok as we already recommend not to have long hint text with lists or paragraphs. However, we want to explore what the actual effect of this in when using |
Having had a chat with the other developers about this, we're confident in the change to error messages but think we're going to hold off on the change to hints for now as it's quite different to recommend users not to write long hint text vs actually forcing them not to. We know there are some examples of extremely long hint text which aren't appropriate, but there are also probably some more in the middle ground which wouldn't be allowed by this change but are probably not too noisy for screenreader users. The new guidance on avoiding complex hint text goes some way to providing people with an alternative, but it assumes one question per page. This change probably needs a bit more research first. As a side note, the possibility of adding |
This change has been made for error messages in #2452, but I'm re-opening this issue as we haven't made the change for hints yet (see comment above). |
An example where a service might legitimately have a 'long hint', but isn't really long - where they have both a single line hint and an example for formatting. A date might have a hint like:
|
What
Consider updating hints and error messages to use paragraphs rather than spans and divs.
govuk-frontend/src/govuk/components/error-message/template.njk
Lines 3 to 6 in d5a3fa8
govuk-frontend/src/govuk/components/hint/template.njk
Lines 1 to 4 in d5a3fa8
Why
As raised by a user on x-gov Slack:
It looks like hints used to be paragraphs, but were changed to spans when the hints were moved inside the label – presumably as only phrasing content is permitted within a
label
. Error messages, when they were added later, were also spans inside the label.We recently updated hints to use divs rather than spans so that they can be used with flow content (for example multiple paragraph tags, or a list)
Since we moved hints and error messages out of the labels, we should consider whether they should now by marked up as paragraphs instead.
Who needs to know about this
Developers, designers
Done when
display:block
hint style as we're switching from span to div #1856 needs updating as a result of this workThe text was updated successfully, but these errors were encountered: