govuk-design-system-backlog icon indicating copy to clipboard operation
govuk-design-system-backlog copied to clipboard

Warning text

Open govuk-design-system opened this issue 7 years ago • 23 comments

Use this issue to discuss the warning text component in the GOV.UK Design System.

Description

Use warning text to warn users about something they need to know, such as legal consequences of an action, or lack of action, that they might take.

govuk-design-system avatar Jan 12 '18 16:01 govuk-design-system

Noticed that the govuk-warning-text__text element has padding left that includes an extra 15px to compensate for a negative margin left (see below, dotted outline added by me to show boundary of component). Seems like this could be removed and the padding decreased, but there must be a reason for it?

screen shot 2018-12-03 at 11 30 12

andysellick avatar Dec 03 '18 11:12 andysellick

@andysellick I'm going to move this to the GOV.UK Frontend repository

NickColley avatar Dec 03 '18 11:12 NickColley

Does the icon sit inline with the first line if a paragraph is over two or more lines?

a184studio avatar May 15 '19 10:05 a184studio

@a184studio As the screen size will change, the amount of lines is somewhat of an unknown. Using the warning text component from the Design System the icon is vertically centred within it's container. Here's an example below:

warning text

If you have a very large amount of warning text, such as actual full paragraphs then I could see the benefit to overriding the default and aligning to the top of the container. However it might be better to revisit the amount of content to give a short warning and an accompanying paragraph below to explain the details.

dashouse avatar May 15 '19 10:05 dashouse

@dashouse / Dave This is what I'm looking at, three lines within the paragraph.

Screen Shot 2019-05-15 at 10 03 52 ![Screen Shot 2019-05-15 at 10 02 57](https://user-images.githubusercontent.com/44495654/57770450-3ab69a00-7708-11e9-9d97-81e5cb11024a.png)

a184studio avatar May 15 '19 10:05 a184studio

@a184studio Thanks for the context, I think aligning to the first line in this case is fine. Although it doesn't make a huge amount of difference on large screens I imagine it would be 7 or 8 lines on mobile so there would be some benefit to see the icon in-line with the first line.

Generally I am wondering if this message constitutes a Warning, Inset text (https://design-system.service.gov.uk/components/inset-text/) may be a better fit?

p.s. I will create an issue to consider adding an align-top option to warning text

dashouse avatar May 15 '19 11:05 dashouse

@dashouse Thanks I'll take it back to my content regarding the (!), we I was looking for (i) information Icon. On the HTML options there is an option for adding the (i), i didn't see one for the Nunjucks.

“I will create an issue to consider adding an align-top option to warning text” Great thanks, from a typographic point of view it makes more sense and it's doing a DropCap job. Those sit in the first line of a paragraph and then lead on to the information.

Thanks Dave

a184studio avatar May 15 '19 11:05 a184studio

@dashouse For a temporary hack I did this.

.govuk-warning-text__icon { top: 33.3%; }

a184studio avatar May 15 '19 14:05 a184studio

@a184studio thanks for sharing.

Dave has raised an issue for this here: https://github.com/alphagov/govuk-frontend/issues/1352

Your hack will work fine for a prototype but if you are considering that for production I would recommend doing something like:

.app-warning-text--long {
  top: 33.3%;
}
<div class="govuk-warning-text app-warning-text--long">
 <!-- ... -->
</div>

See Extending and modifying components in production for more information.

NickColley avatar May 15 '19 14:05 NickColley

@nickcolley God yeah, this is for a prototype only. But i have named it the way you have suggested. I'll look out for an official version.

a184studio avatar May 15 '19 14:05 a184studio

I'm considering using a link inside of warning text and note the text colour of the anchor isn't set to black - is this intentional?

What it looks like on my service: Screenshot 2019-06-20 at 10 58 24

edwardhorsford avatar Jun 20 '19 09:06 edwardhorsford

A minor one: when used alongside radios, the warning icon is close but annoyingly not the same size as them. The text is also not quite in line with radio options.

Any thoughts on making the size consistent? Screenshot 2020-02-10 at 10 51 24

Manually fudged: Screenshot 2020-02-10 at 10 57 32

Manual fudge is visually the same size but actually a bit smaller because of perception of solid shapes.

edwardhorsford avatar Feb 10 '20 10:02 edwardhorsford

Is there any semantics in here for accessibility? Seems it's a very simple div/span with no easy way to alert screen reader users. The Canadian & USA gov design tools are both at least recommending use of headings.

Also, how do you differentiate errors, warnings, information and regular status updates?

https://designsystem.digital.gov/components/alert/ https://wet-boew.github.io/themes-dist/GCWeb/provisional-en.html#alert

mgifford avatar Jun 16 '20 14:06 mgifford

@mgifford Yeah Exactly that. (In reference to alignment, inline with first line.)

a184studio avatar Jun 16 '20 15:06 a184studio

Hi @mgifford, thanks for the feedback.

This component isn't intended to be used as an alert, but as a way of styling content on a page that draws attention to its warning nature.

For users of screen readers the component contains a text fallback that is read out before the content. This defaults to the word 'Warning', but can be overridden. The content is marked up using a <strong> tag to semantically emphasise its importance.

The component doesn't contain a header because that would imply that it is the header of whatever content follows it, and this isn't how the component is intended to be used.

We're in the process of developing a new component for alerts and notifications, and this will include markup to help users of assistive technology.

timpaul avatar Jun 16 '20 16:06 timpaul

This is an example of the warning text component used in context:

Screenshot 2020-06-16 at 17 01 24

https://www.gov.uk/guidance/coronavirus-covid-19-mots-for-cars-vans-and-motorcycles-due-from-30-march-2020#get-unsafe-vehicles-repaired

36degrees avatar Jun 16 '20 16:06 36degrees

Ok, so in the example above @36degrees this is the HTML:

<div role="note" aria-label="Warning" class="application-notice help-notice">
<p>You can be fined up to £2,500, be banned from driving and get 3 penalty points for driving a vehicle in a dangerous condition.</p>
</div>

I don't think this is right either https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-label_attribute

But it also isn't defined here in the pattern: https://design-system.service.gov.uk/components/warning-text/

@timpaul I don't know what the answer is to this, but GDS is a leader in User Research? What have you found engaging with people with disabilities? Is <strong> sufficient for them?

You have less semantics than the Government of Canada or USA. That might be appropriate, but would be good if there was some evidence to back this up.

mgifford avatar Jun 16 '20 16:06 mgifford

Ok, so in the example above @36degrees this is the HTML:

<div role="note" aria-label="Warning" class="application-notice help-notice">
<p>You can be fined up to £2,500, be banned from driving and get 3 penalty points for driving a vehicle in a dangerous condition.</p>
</div>

I don't think this is right either https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-label_attribute

But it also isn't defined here in the pattern: https://design-system.service.gov.uk/components/warning-text/

Apologies, it looks like the page I linked to hasn't been fully migrated to the Design System, and so is using older markup. The intent was to show an example of the warning text component in context.

You have less semantics than the Government of Canada or USA. That might be appropriate, but would be good if there was some evidence to back this up.

The components have different semantics because they're designed to do different things.

The alerts component in the USWDS is designed (according to their own documentation) to '[keep] users informed of important and sometimes time-sensitive changes', and as far as I can see from the examples would be used e.g. at the top of the page to inform users that something has happened, perhaps as a result of an action they've taken.

It makes sense therefore that it uses the alert role, as this means that assistive technology can then notify the user about it.

The warning text component is designed to 'warn users about something important, such as legal consequences of an action, or lack of action, that they might take' – to emphasise important information within a wider piece of content. It's designed to be read in the context of that content, and it would be inappropriate to use the alert role for it.

In terms of user research, if there were issues with the warning text flagged during research we'd expect to hear about them through our support channels or via this GitHub issue (you can see a good example of this in action in the backlog issue for the task list pattern.

@a184studio the alignment of the warning text component was changed in https://github.com/alphagov/govuk-frontend/pull/1578, which was released as part of GOV.UK Frontend v3.3.0.

36degrees avatar Jun 17 '20 08:06 36degrees

This is definitely useful, so thanks.

The USWDS only uses ARIA on the Error status messages. This would definitely be in conjunction with an interaction of some sort where this immediate response would be expected. So agreed that it's not the best for a warning, such as that which might occur at the top of the page.

It could be that there is a failing in HTML/ARIA to effectively highlight text that should be highlighted.

I do still think that having a heading in the warning is the best way to alert an assistive technology user for inline status messages, whether they are just informative, warnings or success indicators. I'm not sure that just a <strong> tag is an equivalent.

mgifford avatar Jun 17 '20 15:06 mgifford

Here's what the Australian government has done with this pattern https://designsystem.gov.au/components/page-alerts/rationale/

mgifford avatar Jun 24 '20 14:06 mgifford

Here's what the Australian government has done with this pattern https://designsystem.gov.au/components/page-alerts/rationale/

Just to be clear, alerts like those may look similar when viewed in isolation but are still doing a fundamentally different thing to the warning text component.

If you wanted to add a link to that to the backlog entry for alerts that'd be helpful as reference when we build out the alerts component.

36degrees avatar Jun 24 '20 14:06 36degrees