Interactive questions – GCWeb design system

Interactive questions are used to present people with a sequence of simple questions that leads to the specific answer they need to continue with or complete their task.

Interactive questions may also be referred to as decision trees or wizards.

On this page

Considering user needs

Using this pattern with UCD guidance supports:

When to use

Use interactive questions to help people find an answer to their specific situation or condition.

This component is well suited to helping people understand:

Alternative way to provide answers

The content should already exist in a text format. This text version is the authoritative content, and the interactive questions are the supportive feature.

People who need a full text equivalent are those who:

When to consider alternatives

If most answers can be reached in 1 or 2 questions, consider one of the following ways to present the information:

These other ways of presenting the information remove the requirement of providing a full text equivalent as they do not hide content with scripts.

How to implement

Interactive questions should follow these fundamental principles:

On Canada.ca, interactive questions use the GCWeb component field flow, which has not been optimized for complex interactive questions. Be cautious when designing content as there are limitations on how the code can function or be displayed.

Creating interactive questions

Focus on the majority of the audience

Keep options unique

Each option in the same question should lead to different answers or next questions. Consider using the options Yes/No/Unsure for questions where multiple options may have the same answer.

If multiple options in one question must lead to the same result, each result or answer should be personalized to each option.

Example

If the options are:

  • Canadian citizen
  • Permanent resident
  • Non-resident

and choosing either Canadian citizen or Permanent resident both provide the same result, consider restructuring the question to be:

  • "Are you a Canadian citizen or Permanent resident?"
    • Yes
      • Proceed to next part
    • No
      • "Are you a non-resident?"
        • Yes
        • No

Map out interactive questions

For most situations, you can map interactive questions out as a nested list.

Refer to the logic map tab in the design options.

Common actions that are used after a choice has been made are:

Introducing interactive questions on the page

Placement of interactive questions within existing content

If the interactive questions are part of the content on the page (a step in a larger task), use headers before and after interactive questions to separate the rest of them from the rest of the content.

Additionally to headers, consider using visual indicators to show when the interactive questions start and stop (for example, tabs, icon, indenting, border and well are all acceptable options).

Presenting questions

Example

Preferred:

Are you a Canadian citizen or permanent resident?

  • Yes
  • No

An acceptable alternative:

What is your residency status?

  • Canadian citizen
  • Permanent resident
  • Non-resident

Can cause issues:

Are you one of the following:

  • A Canadian citizen
  • A permanent resident
  • Yes
  • No

Adding supportive statements

If a specific question requires additional information and it cannot be added before the interactive questions, consider these options:

Refer to: Design options

Presenting answers

Use alerts to provide answers

Use alerts to show that a series of questions has ended and a conclusion has been made.

Use the correct alert based on the type of answer:

Add a header to the alert to provide an overview of what the answer is. Start with a clear statement, such as "The result is" or "Your answer is " to help people understand that it is the end of the questions.

Refer to: Design options

Use attributes to allow navigation out of the questions

There are different ways to code for accessibility depending on if the answer is shorter or longer. You can help persons using screen readers, navigate out of the form elements in 1 of 2 ways:

Presenting the text version

The full text version can be displayed:

Design options

Due to limitations, the appearance examples may not be fully accessible. Copy the code from the HTML code tab.

Things to consider:

Additional information options

  • Default
  • Supportive statement after question
  • Lead in statement before question
  • Complex information after question
Appearance

Confirm you have completed the calculations

Make a selection and then scroll down to see the next set of options or your result.

Have you calculated the subsidy amount for your business?

  • Yes

    Do you expect a payment of $25 million or more?

    • Yes
    • No
  • No
HTML code

Removed example text from appearance and logic map for easy copy and paste.

<div class="wb-frmvld fieldflow-lg"> <form> <div class="wb-fieldflow gc-font-2019" data-wb-fieldflow='{"noForm": true, "isoptional": true, "renderas":"radio", "gcChckbxrdio":true, "reset": {"action": "addClass", "source": ".alert-result", "class": "hidden"}}'> <!--Question 1 --> <p>[Question 1]</p> <ul> <li>Yes <div class="wb-fieldflow-sub gc-font-2019" data-wb-fieldflow='{"renderas": "radio", "gcChckbxrdio":true, "isoptional": true, "reset": {"action": "addClass", "source": ".alert-result", "class": "hidden"}}'> <p><span id="q2">[Question 2]</span></p> <ul> <li data-wb-fieldflow='{"action": "removeClass", "source": "#answer-2", "class": "hidden", "live": true}'>Yes</li> <li data-wb-fieldflow='{"action": "removeClass", "source": "#answer-3", "class": "hidden", "live": true}'>No</li> </ul> </div> </li> <li data-wb-fieldflow='{"action": "removeClass", "source": "#answer-1", "class": "hidden", "live": true}'>No</li> </ul> </div> </form> </div> <div id="answers1" aria-live="polite"> <!--Answer 1 --> <div id="answer-1" class="hidden alert alert-warning alert-result"> <h3><small>The result is</small> <br>[Answer 1 header]</h3> <p>[Answer 1 statement]</p> </div> <!-- Answer 2 --> <div class="hidden alert alert-info alert-result" id="answer-2"> <h3><small>The result is</small> <br>[Answer 2 header]</h3> <p>[Answer 2 statement]</p> </div> <!-- Answer 3 --> <div class="hidden alert alert-success alert-result" id="answer-3"> <h3><small>The result is</small> <br>[Answer 3 header]</h3> <p>[Answer 3 statement]</p> </div> </div>
Logic map

These are a couple of ideas on how to map out interactive questions.

Option 1

  • Q1: Have you calculated the subsidy amount for your business?
    • Yes
      • Q2: Do you expect a payment of $25 million or more?
        • Yes
          • Answer [1]: You need to calculate the subsidy first

            In order to apply, you need to calculate your subsidy amount for your eligible employees first.

            [Calculate your subsidy amount (Link: URL goes here)]

        • No
          • Answer [2]: You need to report the payment first

            Before you apply you must:

            • Register for this program by sending an email to [email@cra-arc.gc.ca (Email: email address goes here)]
            • [Set up direct deposit (Link: URL goes here)]
    • No
      • Answer [3]: You can apply

        You can go ahead and [apply for this benefit (Link: URL goes here)].

        Or, if needed: [Set up direct deposit (Link: URL goes here)].

Option 2

Question 1

Q: Have you calculated the subsidy amount for your business?

  • Yes (Go to question 2)
  • No (Go to answer 1)

Question 2

Q: Do you expect a payment of $25 million or more?

  • Yes (Go to answer 2)
  • No (Go to answer 3)

Answer 1: You need to calculate the subsidy first

In order to apply, you need to calculate your subsidy amount for your eligible employees first.

[Calculate your subsidy amount (Link: URL goes here)]

Answer 2: You need to report the payment first

Before you apply you must:

  • Register for the Large Value Transfer System (LVTS) by sending an email to [email@cra-arc.gc.ca (Email: email address goes here)]
  • [Set up direct deposit (Link: URL goes here)]

Answer 3: You can apply

You can go ahead and [apply for this benefit (Link: URL goes here)].

Or, if needed: [Set up direct deposit (Link: URL goes here)].

Configuration options

For instructions on how to configure the component that supports interactive questions, refer to: field flow for GCWeb design guide.

Meeting accessibility requirements

The Accessible Canada Act (ACA) requires content created for the Canada Revenue Agency (CRA) meets the goal of realizing a barrier-free Canada by 2040. For our digital products, Accessibility Standards Canada follows the European harmonized standard on Information and Communication Technology (ICT). The CRA uses the Web Content Accessibility Guidelines (WCAG) 2.1 to meet the ACA, and must be compliant to WCAG level A and AA.

By following the guidance in the UCD Guide, your web content should meet the following WCAG success criteria: 

While not required, to further enhance accessibility, you may also meet WCAG level AAA success criteria:

Supporting blog post

The interactive question component provides simple and clear answers to someone when they try to accomplish a task.

[8 April 2021]

Complementary components and functions

Additional add-on features and behaviours are available.

Date modified: