Commit Graph

380 Commits

Author SHA1 Message Date
Pea Tyczynska
bd19b1171c Autofocus now optional for live_search
This change has been made because autofocus has been confusing
to users of screenreaders because they orient themselves by
what is in focus. Moving it when the page loads without warning
can cause confusion and mean they miss parts of the page
before the point focus has moved to.

So now we will only turn on autofocus if there are no other
elements in the page that need attention than the search box.
2020-09-24 12:27:10 +01:00
Tom Byers
43935457d8 Change live-search so it announces results
If there is a search term when the page loads, a
statement about the results is added to the
searchbox label.

All subsequent searches are announced via an aria
live-region.
2020-09-17 14:38:40 +01:00
karlchillmaid
60a63c69ee Merge pull request #3578 from alphagov/update-sent-status-label
Update sent status label
2020-09-17 13:16:41 +01:00
Chris Hill-Scott
daaa3d69a3 Make sent international status display on 2 lines
Otherwise it wraps awkwardly
2020-09-17 12:33:46 +01:00
Tom Byers
ddf54d5ce3 Give selected pill item an id 2020-09-10 23:11:13 +01:00
Tom Byers
7589ee1cd5 Revert "Fix aria on jobs page" 2020-09-10 17:34:05 +01:00
Tom Byers
af369fd5a2 Give selected pill item an id 2020-09-09 22:31:11 +01:00
Tom Byers
58ad6fe4c7 Remove pill-item__label--selected class
It was used to mark labels of selected items when
we thought they might need extra styling but is
now redundant.
2020-09-08 11:46:32 +01:00
Tom Byers
452e253e2c Make the selected pill item a link
All other navigations have their selected item as
a link so we should match this.

Includes changes to the pill CSS so:
1. it doesn't use elements in the selectors
2. all the selectors use BEM

I did 2. because I had to change the
classes/selectors anyway, they might as well match
the style GOVUK Design System uses.
2020-09-04 16:17:04 +01:00
Tom Byers
c6711a113c Update h1 on pill pages to work with new pill
Pill pages are:
- /notifications
- /template-usage
- /monthly
- /organisations/<organisation_id>
- /templates

Includes changes to:
- the folder-path component
- the page-header component

...all their h1s have the same id.
2020-09-04 09:02:36 +01:00
Tom Byers
48902a2bac Give all h1s an id 2020-09-04 09:02:36 +01:00
Tom Byers
9598d3a97b Change pills from tabs to navigation
Changes the HTML to do the following:
- remove all tabs semantics
- give the list a role of navigation
- label the navigation with the h1
- mark the selected item with aria-current
2020-09-04 09:02:36 +01:00
Tom Byers
676a9297fe Merge pull request #3593 from alphagov/fix-link-and-button-text-across-pages
Fix link and button text across pages
2020-09-01 15:11:09 +01:00
Tom Byers
aff584b933 Fix comparison in api_key component
We can't control the case of either 'name' or
'thing' so the comparison should make them both
the same.
2020-08-28 13:07:38 +01:00
Tom Byers
e42adecd07 Add context to service settings links 2020-08-25 21:27:03 +01:00
Tom Byers
f608d5e979 Add context to banner button text
Needs flash messaging system changes.
2020-08-25 20:52:21 +01:00
Tom Byers
0933485995 Add context to 'Move' button on /templates
Includes adding an extra parameter to the
page_footer component.
2020-08-25 20:52:21 +01:00
Tom Byers
334c2677dc Add context to 'Hide' button in cookie banner 2020-08-25 20:52:21 +01:00
Tom Byers
a0e78e6102 Changes to API key component
Changes the interface so:
- `name` is a required argument
- the heading is only shown if `name` and `thing`
  match

These changes reflect a pattern observed in how
the component is used in pages.

It's first worth stating what the `thing` and
`name` arguments are.

`thing` is the type of thing the id is, for
example an reply-to email address.
`name` is which one of that type in the page, for
example the reply-to email address for user 1.

In pages where the id is the only one of its type,
these will have the same value.

When it is the only one of its type in a page, it
always has a heading so this makes the heading
appear based on `name` matching `thing`.
2020-08-25 10:54:42 +01:00
Tom Byers
7fd034a83f Change how live region works with API key JS
Includes implementation of new code on Reply-to
email addresses page.

The existing code put the live region on the
module element so the id and button were
read out when the state changed.

The report from the Digital Accessibility Centre
(DAC) said screenreader users were confused by the
content changing because it wasn't announced.

These changes attempt to make the state changes
clearer by:
1. moving the live region out into a separate
  element so we can better control what is
  announced
2. adding hidden text around to the button and text
  above (sometimes the id, sometimes the 'Copied
  to clipboard' text) to give more context

When the id is copied to clipboard, the button
changes but this is not announced as the
live-region text takes precedence (due to being
set to 'assertive'). Because of this, hidden text
has been added in change 2 to explain what the new
button does.
2020-08-25 10:54:42 +01:00
Pea Tyczynska
ad3b391e46 Convert ListEntry component to use new fields
ListEntry component uses FieldList field to group
textboxes. Textboxes can be text inputs, email fields
or international phone number fields. This converts
all field-lists to use:

- GovukTextInputField
- GovukEmailField
- InternationalPhoneNumber

Affects these forms:
- OrganisationDomainsForm
- GuestList

Also changes to related Javascript:

Update list-entry JS tests to match new HTML

Updates the HTML the JS operates on in the test
(a fixture representing the HTML in the page on
load) to match the new GOVUK Frontend we are
generating.

Make list-entry JS work with GOVUK Frontend HTML

The existing list-entry JS did a few things that
clashed with how the new HTML works:
- added a 'input-' prefix to the id attributes
  of all text-inputs
- did not make its name and id attributes values
  match

The new HTML has id and name attributes that
match so these changes remove the prefix for id
attributes and makes them match the name
attribute.

To understand these changes, it is useful to
know how the values for id and name attributes are
generated:
1. the id attribute for the component element is
   stored
2. the 'list-entry-' prefix is removed and the
   remainder is used to generate ids

For example, if the component's id is
'list-entry-domains', the id will be 'domains-1',
where the text-input is the first one.

This also adds some logic to the HoganJS template
to make the value attribute optional, so it is
only added if it has a non-null value. This
matches the behaviour of the text-input component
used in the new list-entry component.

Also change whitelist references to guestlist in tests
- we forgot to do it earlier, when we moved from calling this
feature whitelist to calling it guestlist.
2020-08-12 10:34:51 +01:00
Tom Byers
d21b9475ba Convert SearchFields to GovukSearchFields
Changes those fields in the following forms:
- SearchByNameForm
- SearchUsersByEmailForm
- SearchUsersForm
- SearchNotificationsForm

Includes changes to templates that use this form
and associated tests.
2020-08-12 10:34:50 +01:00
Tom Byers
a74501f1d8 Merge pull request #3535 from alphagov/try-introducing-govuk-checkboxes-again
Try introducing govuk checkboxes again
2020-08-04 14:39:54 +01:00
Chris Hill-Scott
053ed96974 Make start time explicit when previewing a broadcast
We recently introduced a form control that lets user choose when a
broadcast ends.

Based on the most recent research participant, we think:
- there is a specific misunderstanding of what this control does
- there is a general low level of understanding of what a ‘broadcast’
  means

People will try to understand what a ‘broadcast’ is by using mental
models they have for other kinds of messaging, for example text
messages.

Other kinds of messaging are one-to-one, i.e. they go from a sender to a
recipient. They are not ongoing in any way.

Emails and texts are sent at a time (and for all practicable purposes
are received at that same time). So, when we present the user with
a form that controls time, they might well assume it controls the time
when the message will be sent.

This is a feature we offer for sending messages using a spreadsheet, and
that’s where we’ve borrowed this pattern from.

We reinforce this assumption with the labelling of the form control. By
front-loading it with the word ‘When’ we are playing to the users
confirmation bias, i.e. they are interpreting the meaning of the control
in a way that confirms their prior beliefs about how messaging works.

So this commit does two things:
- re-labels the form to front-load the word ‘End’ not ‘When’
- adds text to the page explaining when the broadcast will start, so
  there’s a chance of overriding that confirmation bias

If we can get users to go through this before sending a broadcast for
real, it could help them learn what a broadcast is, and how it differs
from sending text messages.
2020-07-27 17:33:34 +01:00
Tom Byers
c56a6a1117 Remove all unused checkbox macros and imports 2020-07-24 11:34:02 +01:00
Tom Byers
b5360c14cc Lowercase value of 'show-now-as-default'
To match the boolean value in JavaScript.
2020-07-17 08:28:59 +01:00
Chris Hill-Scott
83156bd16e Let users choose when to end a broadcast
Different emergencies will need broadcasts to last for a variable amount
of time. We give users some control over this by letting them stop a
broadcast early. But we should also let them set a maximum broadcast
time, for:
- when the duration of the danger is known
- when the broadcast has been live long enough to alert everyone who
  needs to know about it

This code re-uses the pattern for scheduling jobs, which has some
constraints that are probably OK for now:
- end time is limited to an hour
- longest duration is 3 whole days (eg if you start broadcasting Friday
  you have the choice of Saturday, Sunday and all of Monday, up to
  midnight)
2020-07-17 08:23:10 +01:00
Tom Byers
dfcddb757e Revert "Re-introduce govuk checkboxes" 2020-07-15 13:41:34 +01:00
Tom Byers
3b23ae46a7 Remove all unused checkbox macros and imports 2020-07-14 10:41:09 +01:00
Chris Hill-Scott
154d4bdb85 Allow adding broadcast templates
At the moment the page is the same as for text message templates,
except:
- different H1
- no guidance about personalisation, links, etc (until we decide how
  these should work)

For now you won’t be able to really create a broadcast template, because
the API doesn’t support it (the API will respond with a 400). But that’s
OK because no real services have the broadcast permission yet.

This required a bit of refactoring of how we check which template types
a service can use, because there were some hard-coded assumptions about
emails and text messages.
2020-07-01 17:17:46 +01:00
Chris Hill-Scott
4df99bd27f Don’t allow paragraphs without class attribute
All paragraphs should have class="govuk-body", or be otherwise
custom-styled. This commit adds some extra checks to our test fixture
that looks for paragraphs that don’t have any styling. Our test coverage
is pretty good, so this should check almost all pages, and prevent
regressions.

I’ve done this in such a way that it can be extended for other elements
(e.g. links) in the future.
2020-05-29 17:11:01 +01:00
Tom Byers
f0f461f5c9 Revert "Change checkboxes to GOVUK frontend" 2020-05-14 16:59:34 +01:00
Tom Byers
1240ca47a9 Remove all unused checkbox macros and imports 2020-05-13 17:37:44 +01:00
Chris Hill-Scott
e2d1401b54 Show error across the whole row
Errors with messages being too long or empty aren’t specific to a single
cell of the uploaded spreadsheet, they’re the results of combining all
the cells with the template.

Previously we could only show errors against a specific cell. This
commit makes it possible to add a super-row which spans all the cells,
into which we can put errors.

The index (header) column then spans both these rows, to show that they
are both associated with the same row of input.

Depends on:
- [x] https://github.com/alphagov/notifications-utils/pull/719
2020-04-17 11:06:34 +01:00
Chris Hill-Scott
a2929ad748 Delay AJAX calls if the server is slow to respond
By default our AJAX calls were 2 seconds. Then they were 5 seconds
because someone reckoned 2 seconds was putting too much load on the
system. Then we made them 10 seconds while we were having an incident.
Then we made them 20 seconds for the heaviest pages, but back to 5
seconds or 2 seconds for the rest of the pages.

This is not a good situation because:
- it slows all services down equally, no  matter how much traffic they
  have, or which features they have  switched on
- it slows everything down by the same amount, no matter how much load
  the platform is under
- the values are set based on our worst performance, until we manually
  remember to switch them back
- we spend time during incidents deploying changes to slow down the
  dashboard refresh time because it’s a nothing-to-lose change that
  might relieve some symptoms, when we could be spending time digging
  into the underlying cause

This pull request makes the Javascript smarter about how long it waits
until it makes another AJAX call. It bases the delay on how long the
server takes to respond (as a proxy for how much load the server is
under).

It’s based on the square root of the response time, so is more sensitive
to slow downs early on, and less sensitive to slow downs later on. This
helps us give a more pronounced difference in delay between an AJAX call
that is fast (for example the page for a single notification) and one
that is slow (for example a dashboard for a service with lots of
traffic).

*Some examples of what this would mean for various pages*

Page | Response time | Wait until next AJAX call
---|---|---
Check a reply to address | 130ms | 1,850ms
Brand new service dashboard | 229ms | 2,783ms
HM Passport Office dashboard | 634ms | 5,294ms
NHS Coronavirus Service dashboard | 779ms | 5,977ms
_Example of the kind of slowness we’ve seen during an incident_ | 6,000ms | 18,364ms
GOV.UK email dashboard | `HTTP 504` | 😬
2020-04-09 12:05:18 +01:00
David McDonald
5b818dcd68 Increase all ajax calls to 5 seconds
The default is 2 seconds and this will mean that we are halving traffic
for these ajax calls which can only be good for trying to limit queries
on the database.

I think the user impact on this will likely not be noticable.

Debatable whether we should up them all even further to 10 seconds but
this is definitely a quick although maybe small win.
2020-03-16 10:41:41 +00:00
Tom Byers
efa892423a Fix issues raised on pull request
Includes:
- make 'remove team member' link, on edit member
  permissions page, destructive
- convert missed links on /features pages
- convert missed links on /using-notify/guidance and sub pages
- give links in browse-lists back their size and
  weight (needed for lists of live and trial
  services on Platform Admin)
- give links on Platform Admin inbound numbers
  page back their size and weight
- update links in JS tests
2020-02-25 10:52:03 +00:00
Tom Byers
2a71cc5481 Convert warning links to govuk-link--destructive
Converts links in the following:
- the page-footer component
- the table component
- the browse-list component
- the notification status, when reporting failures
- validation messaging in the whitelist page
2020-02-25 10:52:03 +00:00
Tom Byers
58c08ad89b Replace browse-list links 2020-02-25 10:52:03 +00:00
Tom Byers
ee9f348ce4 Update all links to use GOVUK Frontend style
Includes:
- turning off :visited styles to match existing
  design
- swapping heading classes used to make links bold
  for the GOVUK Frontend bold override class
- adding visually hidden text to some links to
  make them work when isolated from their context

We may need to revisit whether some links, such as
those for documentation and features, may benefit
from having some indication that their target has
been visited.
2020-02-25 10:47:24 +00:00
Tom Byers
5b306dde4d Revert "Convert all links to govuk frontend" 2020-02-24 11:56:38 +00:00
Tom Byers
97172cca30 Merge branch 'master' into convert-all-links-to-govuk-frontend 2020-02-24 10:12:58 +00:00
Chris Hill-Scott
da4ff4b448 Add Design System class to remove visited state from links
Co-Authored-By: Tom Byers <tombaromba@gmail.com>
2020-02-21 09:29:37 +00:00
Chris Hill-Scott
75927a8d05 Fix links to current service pages from guidance
This wasn’t working because:
- macros don’t have access to `current_service` from within their scope
- there were no tests for this behaviour
2020-02-20 15:13:12 +00:00
Tom Byers
5459dd8c13 Fix issues raised on pull request
Includes:
- make 'remove team member' link, on edit member
  permissions page, destructive
- convert missed links on /features pages
- convert missed links on /using-notify/guidance and sub pages
- give links in browse-lists back their size and
  weight (needed for lists of live and trial
  services on Platform Admin)
- give links on Platform Admin inbound numbers
  page back their size and weight
- update links in JS tests
2020-02-20 09:19:06 +00:00
Tom Byers
548265dbe4 Convert warning links to govuk-link--destructive
Converts links in the following:
- the page-footer component
- the table component
- the browse-list component
- the notification status, when reporting failures
- validation messaging in the whitelist page
2020-02-20 09:11:26 +00:00
Tom Byers
a61856ffe1 Replace browse-list links 2020-02-20 09:11:26 +00:00
Tom Byers
cd36182ea6 Update all links to use GOVUK Frontend style
Includes:
- turning off :visited styles to match existing
  design
- swapping heading classes used to make links bold
  for the GOVUK Frontend bold override class
- adding visually hidden text to some links to
  make them work when isolated from their context

We may need to revisit whether some links, such as
those for documentation and features, may benefit
from having some indication that their target has
been visited.
2020-02-20 09:11:26 +00:00
karlchillmaid
5ba5ee2502 Merge pull request #3302 from alphagov/guidance-simplify-numbered-lists
Guidance simplify numbered lists
2020-02-19 16:31:31 +00:00
Chris Hill-Scott
46a4e1c612 Add a macro for generating current service links
This is a convenient way of being able to link into pages of the the app
from guidance. It handles the case where the current service is not
known, either because the user hasn’t chosen one, or because they’re not
signed in.

This commit also cleans up some unused Jinja imports.
2020-02-19 08:22:45 +00:00