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

Add task list component and pattern #2031

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
:new: **New features**

- Add new warning button to buttons component
- Add new Task list component
- Add new Complete multiple tasks pattern

:wrench: **Maintenance**

Expand Down Expand Up @@ -94,7 +96,7 @@
- Remove embedded link from contents list design example
- Fix link in section on link text in accessibility guidance

## 6.1.0 - 18 January 2024
## 6.1.0 - 18 January 2024

:new: **New features**

Expand Down
1 change: 1 addition & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ app.set('view engine', 'njk');
const appViews = [
path.join(__dirname, '/app/views/'),
path.join(__dirname, '/node_modules/nhsuk-frontend/packages/components'),
path.join(__dirname, '/node_modules/nhsuk-frontend/packages/macros'),
];

const env = nunjucks.configure(appViews, {
Expand Down
4 changes: 2 additions & 2 deletions app/views/design-system/components/tag/colours/index.njk
Copy link
Contributor

Choose a reason for hiding this comment

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

A bit off-topic for this PR maybe but, I notice we have two example of an 'Active' tag, one with the default dark blue and one with nhsuk-tag--aqua-green. The task list should see more usage of these status tags so perhaps we should fix them?

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</td>
<td class="nhsuk-table__cell">
{{ tag({
text: "Started",
text: "In progress",
classes: "nhsuk-tag--white"
})}}
</td>
Expand All @@ -25,7 +25,7 @@
</td>
<td class="nhsuk-table__cell">
{{ tag({
text: "Not started",
text: "Inactive",
classes: "nhsuk-tag--grey"
})}}
</td>
Expand Down
63 changes: 63 additions & 0 deletions app/views/design-system/components/task-list/default/index.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{% from "task-list/macro.njk" import taskList %}

{{ taskList({
idPrefix: "your-health",
items: [
{
title: {
text: "Exercise"
},
href: "#",
status: {
text: "Completed",
classes: "nhsuk-task-list__status--completed"
}
},
{
title: {
text: "Personal health"
},
href: "#",
status: {
text: "Completed",
classes: "nhsuk-task-list__status--completed"
}
},
{
title: {
text: "Family health history"
},
hint: {
text: "Details of your parents, brothers and sisters"
},
href: "#",
status: {
tag: {
text: "Incomplete",
classes: "nhsuk-tag--blue"
}
}
},
{
title: {
text: "Smoking history"
},
href: "#",
status: {
tag: {
text: "Incomplete",
classes: "nhsuk-tag--blue"
}
}
},
{
title: {
text: "Blood test"
},
status: {
text: "Cannot start yet",
classes: "nhsuk-task-list__status--cannot-start-yet"
}
}
]
}) }}
99 changes: 99 additions & 0 deletions app/views/design-system/components/task-list/index.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
{% set pageTitle = "Task list" %}
{% set pageSection = "Design system" %}
{% set subSection = "Components" %}
{% set pageDescription = "Use the task list to give users more control over how they complete long, complex services." %}
{% set theme = "Content presentation" %}
{% set dateUpdated = "October 2024" %}
{% set backlog_issue_id = "304" %}

{% extends "includes/app-layout.njk" %}

{% block breadcrumb %}
{% include "design-system/components/_breadcrumb.njk" %}
{% endblock %}

{% block bodyContent %}

<p>The task list component displays all the tasks a user needs to do, and allows users to easily identify which ones are done and which they still need to do.</p>

{{ designExample({
group: "components",
item: "task-list",
type: "default"
}) }}

<h2 id="when-to-use-the-task-list">When to use the task list</h2>

<p>Use the task list to give users more control over how they complete long, complex services.</p>
anandamaryon1 marked this conversation as resolved.
Show resolved Hide resolved
<p>Only use the task list if there's evidence that users:</p>
<ul>
<li>do not want to, or cannot, complete all the tasks in one sitting</li>
<li>need to be able to choose the order they complete the tasks in</li>
</ul>

<h2 id="when-not-to-use-the-task-list">When not to use the task list</h2>
<p>Try to simplify the service before you use a task list. If you're able to reduce the number of tasks or steps involved, you might not need one.</p>
<p>Do not use the task list for a long service that needs to be completed in a specific order. If it needs to be completed over multiple sessions, consider allowing users to save their progress, and then to continue where they left off when they return. Use the start page to explain what users will be expected to do during the service.</p>
<p>The task list should not be used as a way of showing users their answers. For this, you should use a <a href="/design-system/components/summary-list/">summary list</a> instead.</p>

<h2 id="how-the-task-list-works">How the task list works</h2>

<p>Users should be able to complete tasks in whatever order they like.</p>
<p>The status alongside the task indicates whether they can start it. Users can select a task to start completing it. Once they have completed it and returned to the task list, the status for that task will have changed to "Completed".</p>
<p>Users can only move on from the task list when all tasks are shown as "Completed".</p>
<p>Find more information about how to use the task list within a service in the <a href="/design-system/patterns/complete-multiple-tasks/">complete multiple tasks pattern guidance</a>.</p>

<h3 id="tasks">Tasks</h3>

<p>Tasks are usually actions that the user needs to take to complete a service. In a task list, the user should be able to choose to complete tasks in any order that works for them.</p>
anandamaryon1 marked this conversation as resolved.
Show resolved Hide resolved
<p>Each task within a task list includes a task name and a status. It can also include hint text if you decide this is needed.</p>
<p>The whole row is linked, allowing users to select anywhere within it to start the task.</p>

<h4>Write clear task descriptions</h4>
<p>The task name gives users a reasonable expectation of what that task is about. For example, "Your contact details" or "Upload evidence". Use sentence case, and keep it short. Users of screen readers might find it difficult to navigate the task list if the task names are too long.</p>
<p>If you're finding it difficult to come up with a clear and concise task name, it might be because the task itself is too complex and may need to be separated into smaller tasks. Group questions and actions into tasks in a way that makes sense to users, based on their needs.</p>

<h4>Adding hint text</h4>
<p>Only use hint text if there is evidence that the user needs more information about what the task will include.</p>
<p>Keep hint text to a single, short sentence. Screen readers read out the entire text when users interact with the task link. This could frustrate users if the text is long.</p>
<p>Do not include links within the hint text. The whole task row links users to the task itself, so any links within the hint text will not work.</p>

<h4>Grouping tasks</h4>
<p>If there are a lot of tasks to complete, you might find that grouping them makes it easier for users to understand and plan what they need to do. Tasks can be grouped into separate task lists on a page. Give each task list a short heading that clearly explains the grouping.</p>
<p>Find more information on grouping tasks in the <a href="service-manual/patterns/complete-multiple-tasks/">complete multiple tasks pattern guidance</a>.</p>

<h3 id="statuses">Statuses</h3>
<p>Statuses use colour and a short descriptor to give users a quick overview of how much of the task list they have completed, and how much is left to do.</p>
<p>Find more information on status colours and text in the <a href="service-manual/patterns/complete-multiple-tasks/">complete multiple tasks pattern guidance</a></p>
anandamaryon1 marked this conversation as resolved.
Show resolved Hide resolved

<h2 id="research-on-the-task-list">Research on the task list</h2>
<p>This component was created by a cross-government group using research from the previous task list pattern.</p>

<h3 id="linking-the-whole-task-row-to-the-task">Linking the whole task row to the task</h3>

<p>User feedback from the task list pattern has shown that some users currently try to select task statuses, thinking they are buttons or links. The statuses have been redesigned to look less like buttons, and now the whole task row is linked so that users can select anywhere within it to enter and begin the task.</p>
anandamaryon1 marked this conversation as resolved.
Show resolved Hide resolved

<h3 id="formatting-of-statuses">Formatting of statuses</h3>
anandamaryon1 marked this conversation as resolved.
Show resolved Hide resolved

<p>The use of uppercase in task statuses makes them harder to read. User research has also shown that once a few tasks have been completed, it is harder for users to scan the page and spot incomplete tasks.</p>

<p>Statuses are now written in sentence case to make them easier to read. The "Completed" task now uses black text with no background colour, which will draw more attention to tasks that require action.</p>

<p>We have also introduced a new colour palette for statuses, using colour contrasts that meet accessibility guidance.</p>

<h3 id="known-issues-and-gaps">Known issues and gaps</h3>

<p>While this new component is based on user research from the task list pattern, we still need to carry out user testing with this new component. In particular, we would like to test the following assumptions:</p>

<ul>
<li>the benefits of linking the whole task row outweigh the risks of accidental clicking</li>
<li>the contrast of the statuses is sufficient</li>
<li>the suggested wording of the statuses makes the most sense to users</li>
</ul>

<p>If you are using this component in a service, we would like to hear about any user research so that we can identify any potential issues.</p>




{% endblock %}
121 changes: 121 additions & 0 deletions app/views/design-system/components/task-list/macro-options.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
{
"name": "task-list",
"params": [
{
"name": "classes",
"type": "string",
"required": false,
"description": "Classes to add to the `ul` container for the task list."
},
{
"name": "attributes",
"type": "object",
"required": false,
"description": "HTML attributes (for example data attributes) to add to the `ul` container for the task list."
},
{
"name": "idPrefix",
"type": "string",
"required": false,
"description": "Optional prefix. This is used to prefix the `id` attribute for the task list item tag and hint, separated by `-`. Defaults to \"task-list\"."
},
{
"name": "items",
"type": "array",
"required": true,
"description": "The items for each task within the task list component. See items.",
"params": [
{
"name": "title",
"type": "object",
"required": true,
"description": "The main title for the task within the task list component. See title.",
"params": [
{
"name": "text",
"type": "string",
"required": true,
"description": "Text to use within the title. If `html` is provided, the `text` argument will be ignored."
},
{
"name": "html",
"type": "string",
"required": true,
"description": "HTML to use within the title. If `html` is provided, the `text` argument will be ignored."
},
{
"name": "classes",
"type": "string",
"required": false,
"description": "Classes to add to the title wrapper."
}
]
},
{
"name": "hint",
"type": "object",
"required": false,
"description": "Can be used to add a hint to each task within the task list component. See items hint.",
"params": [
{
"name": "text",
"type": "string",
"required": true,
"description": "Text to use within the hint. If `html` is provided, the `text` argument will be ignored."
},
{
"name": "html",
"type": "string",
"required": true,
"description": "HTML to use within the hint. If `html` is provided, the `text` argument will be ignored."
}
]
},
{
"name": "status",
"type": "object",
"required": true,
"description": "The status for each task within the task list component. See items status.",
"params": [
{
"name": "tag",
"type": "object",
"required": false,
"description": "Can be used to add a tag to the status of the task within the task list component. See tag."
},
{
"name": "text",
"type": "string",
"required": false,
"description": "Text to use for the status, as an alternative to using a tag. If `html` or `tag` is provided, the `text` argument will be ignored."
},
{
"name": "html",
"type": "string",
"required": false,
"description": "HTML to use for the status, as an alternative to using a tag. If `html` or `tag` is provided, the `text` argument will be ignored."
},
{
"name": "classes",
"type": "string",
"required": false,
"description": "Classes to add to the status container."
}
]
},
{
"name": "href",
"type": "string",
"required": false,
"description": "The value of the link's `href` attribute for the task list item."
},
{
"name": "classes",
"type": "string",
"required": false,
"description": "Classes to add to the item `div`."
}
]
}
]
}
Loading