• Atom
  • CORE COMPONENT
  • Taxonomic name: A-CONTEXT-HELP
  • Added on: v4.6.0 (01/02/19)
  • Updated on:DESY v.2023.01 (26/10/2023)

Contextual help

Contextual help consists of triggers and interactions. A trigger is a call to action which initiates the help mechanism; the interaction is the resulting mechanism.
Triggers and interactions can be combined in multiple ways, unless stated otherwise in the use cases. An example of a contextual help combination is, 'i by itself' (trigger) with modal (interaction). The icon (trigger) can load either a tooltip or a modal (both interactions). The rules below state when and where each can and cannot be used.


Design and usage

Structure

Contextual help icon

  • Can be used with or without form field.
  • Icon can be used by itself.
  • Icon can be used alongside text.
  • Icon can be used alongside text link.
  • Icon is always aligned horizontally to the middle of the text's line height.
  • Icon size is always 18px x 18px.
  • Blue icon (#004FB6) to be used on #FFF, #EEE, #CCC, #FFD900, #E5EDF8 backgrounds.
  • White icon (#FFF) to be used on #0E573F, #00788A, #00788A, #1A61BD, #001647, #421B67, #87378E, #C01B83, #413E4F.
  • When placed next to link both the link and icon act as a trigger to modal/tooltip.
  • Do not use the contextual help icon in the masthead, footer, H0/H1 tags, page titles, section headings, images/videos.
  • Advisory: If you have a row of form fields (all on the same horizontal axis) consider using the modal interaction instead of the tooltip for contextual help.

Tooltip

  • When the tooltip opens it pushes the content below it down the page (it's not to be used as an overlay).
  • Tooltip only ever appears below the contextual help icon.
  • The tooltip can only be used when the content is 150 characters or less.
  • The tooltip can be used when the icon is at the end of H2 / H3 / H4 tags / form labels / line and divs.
  • The width of the tooltip follows the width of the component it sits within.
  • When the tooltip opens the icon turns into an 'x'.
  • Once the tooltip is open you can click either the icon or the close button to close it.
  • Tooltip remains open until you close it and all can be open at the same time on a page.
  • Only body copy (16pt) can be used in a tooltip. Do not place anything else inside..
  • The tooltip arrow always sits vertically in line with the icon.
  • Colour of the tooltip box is #E5EDF8 on white and white on any other background accent colour.
  • Do not use the tooltip on a #F9F9F9 background.
  • Do not use tooltips when the icon sits within body copy, paragraphs, sentences or lists (use the modal pattern instead)

Modal

  • Used when you want to show more than 150 characters or components that aren't just body copy.
  • The modal must use the link text as the modal heading.

Errors

  • Notification card errors follow existing rules and appear directly above fields (the same applies when a tooltip is open).

Non-JS requirements and considerations

  • When used within form components, the tooltip content is displayed as regular explanatory text (no contextual help icon should be displayed).
  • Anything outside of forms should use existing non-JS rules.

Accessibility and screen readers

  • When used within a form row aria-describedby must be used to link the contextual help to the form element/fieldset

Use cases and exception scenarios

  • Has the ability to explain a term - further detail on technical terms and words (eg. explaining risk levels to the customer).
  • Has the ability to Explain a questions purpose - further detail on why we are asking it (eg. we ask for your mobile number to send you claim updates).
  • Can provide more context for a question - further detail on the question, product or brand (eg. explaining what we mean by 'during the day').
  • Can provide educational material (in-situ) for customers - further detail for anyone who might have a low understanding of the subject.
  • Either a modal or tooltip can be used depending on what component you use the icon with and the content you want to display.
  • Do not use tooltips for mission-critical or regulatory information.
  • Do not use tooltips where they aren't needed (ie. don't repeat what's already being asked).

Examples

Standard stand-alone tooltip

Interactive example

Code example

Inline content
                                            <p><a class="a-context-help a-link-icon" href="..." data-module="a-context-help" data-module-load="true"><span class="a-link-icon__inner">...</span></a></p>
                                        
Content at bottom of page
                                            <div class="a-context-help-content" id="...">
                                                <h3 class="a-heading a-heading--3 a-heading--semibold a-context-help-content__heading">...</h3>
                                                <p class="a-context-help-content__text">...</p>
                                            </div>
                                        

Stand-alone tooltip, icon with no link text

Interactive example

Code example

Inline content
                                            <p>...<a class="a-context-help a-context-help--hidden-text a-link-icon" href="..." data-module="a-context-help" data-module-load="true"><span class="a-link-icon__inner u-hidden--visually">...</span></a></p>
                                        
Content at bottom of page
                                        <div class="a-context-help-content" id="...">
                                            <h3 class="a-heading a-heading--3 a-heading--semibold a-context-help-content__heading">...</h3>
                                            <p class="a-context-help-content__text">...</p>
                                        </div>
                                        

Modal variant

Interactive example

Code example

Inline content
                                            <p><a class="a-context-help a-link-icon" href="..." data-module="a-context-help" data-module-load="true" data-variant="modal"><span class="a-link-icon__inner">...</span></a></p>
                                        
Content at bottom of page
                                        <div class="a-context-help-content" id="...">
                                            <h3 class="a-heading a-heading--3 a-heading--semibold a-context-help-content__heading">...</h3>
                                            <p class="a-context-help-content__text">...</p>
                                        </div>
                                        

Within a form row

Interactive example

Code example

                                            <div class="m-form-row">
                                                <label class="a-label" for="...">...</label>
                                                <p class="m-form-row__explanatory-text" id="..." data-module="a-context-help" data-module-load="true" data-accessible-text="...">...</p>
                                                <div class="m-form-row__content">
                                                    <input type="email" id="..." name="..." class="a-textbox" aria-describedby="..." />
                                                </div>
                                            </div>
                                        

Development and test

Notes for developers

Context help blocks work by the addition of a link icon with a supporting data-module="a-context-help" data-module-load="true" attribute. As with modals and other components which use Javascript to recreate their content, the main body of the content for the tooltip/modal should be positioned at the bottom of the page (ie, after the rest of the main page content). The contextual help content should begin with a heading which contains the same copy as the link text, so that a user will know the right content has been activated; this is especially important for the non-JavaScript fallback, which will send people to the bottom of the page where there may be several contextual help content blocks.

The modal variant is created the same way as the toolip version, with the addition of the data-variant="modal" attribute. The same rules apply with regard to content placement, headings and so on.

If the text content of a tooltip variant exceed the limit specified in the usage guidelines, the modal variant will be forced anyway. Equally, if a tooltip is incorrectly placed within the normal flow of paragraph content, a modal variant will be forced to prevent the page breaking visually.

For uses with form rows, content is set up as per explanatory text, with the addition of the data-module="a-context-help" data-module-load="true" attribute and a unique id value; this MUST be unique, regardless of whether the same content is used for multiple instances, as it is converted into an id/href pair. If JavaScript is not available, this variant will fall back to a simple explanatory text atom. Be sure to also complete the data-accessible-text content as well; this is converted to hidden text which screen readers will use to apply additional contextual information as to what activating the module will do. This can be as simple as "Help about..." and a repeat of the label, but try to make it as meaningful and as helpful as possible. If this attribute is not completed, the fall back will simply be "Help".

Aria usage for errors and help text

To aid screen reader users in completing forms without error and also with understanding and fixing any errors that have occured, some additional aria attributes are now recommended to be applied across all form fields/rows.

All form row help, explanatory text, form row instructions and form row errors must have a unique id assigned to them and be appropriately linked to either the individual form input or the form row using aria-describedby. This ensures that the help text is read out immediately on focus of the form input/fieldset. When there is more that one item that requires referencing within the aria-describedby attribute the id values must be supplied in the form of a space separated list. For example if there is an error with id of 'err1' and help text with id of 'help1' the value for the aria-describedby attribute would be 'err1 help1'.

All inline form error messages should start with the hidden text 'Error: ' so that when read by out by a screen reader it is immediately clear that the text being read is an error message.

All erroring form fields (or fieldset if a group or radios/checkboxes) must have aria-invalid="true" set on them, ensuring that when a user focus' on an errored form field, the field will be announced as invalid, so the user is then aware that there in an issue that requires fixing.

When linking help or errors, or even adding aria-invalid to the markup careful consideration must be taken as to where it is most appropriate to apply the value. The following rules should be used to decide where the attribute(s) should be applied.

  • Single form field - All attributes should be applied directly to that form field
  • Group of form fields but only one in error or help text applies to only one - Apply the attribute(s) to the only field in error or where the help text applies
  • Group of form field where all in error or the help text applies to all - Apply the attribute(s) to the groups surrounding fieldset (form row)

There may situations where more than one of these rules applies to the overall form row for example a date range where the instruction text applies to both fields so should be linked to the fieldset for the date range but one of the two fields is in error so the error should be linked to just that field not to the fieldset.

Controling the contextual help programatically

Contextual help can be controlled programatically to close the contextual help box/modal. The following method is available for use:

Method Description
close() Close the contextual help box/modal.

For example:

										document.addEventListener( 'frameworkready', function () {
											FRAMEWORK.require([ 'blocks/a-context-help' ], function ( aContextHelpModule ) {
												var aContextHelpEl = document.querySelector( '#multiselectId' ),
													aContextHelpInstance = aContextHelpModule.initInstance( aContextHelpEl );		aContextHelpInstance.close();
											});
										});
									

Changing locale settings

Default text for contextual help can be changed for a particular locale.

										
											en: {
												aContextHelp : {
													formText : 'Help',
													closeText : 'Close',
												},
											},
										
									

For more information on this, see our page on how to change locale settings within JavaScript.


Notes for testers

  • Ensure that all instances of context help icons have matching content.
  • Ensure that all instances of context help has an associated heading as part of the main content.
  • Ensure that all instances of context help within form rows have a unique href value.
  • Ensure users can use both the x icon and the close button within the tooltip/modal to dismiss the contextual help.
  • Ensure users can open/close contextual help instances using both mouse/touch and keyboard.

Classes overview

The following table gives you a quick overview of the CSS classes that can be applied.

Class Outcome Required Applied to Comments
.a-context-help Base class for context help i icon Yes a-link--icon  
.a-context-help-content Class for context help content Yes div  
.a-context-help--no-text-break Classe pour empêcher le retour à la ligne du texte si la place n'est pas suffisante   a-link--icon  
.a-context-help--right
.a-context-help--left
Classe forcer l'alignement à droite ou à gauche et verticalement centré dans une cellule d'un tableau   m-table a-link--icon  

Keyboard operations

TAB

Tabbing to an checkbox input should make the input clearly visually different so that the focus point on the page is obvious to the user.

CURSOR KEYS

With focus on the checkbox, pressing SPACE will select/deselect the checkbox.

Component releases

  • Added on: v4.6.0 (01/02/19)
  • Updated on: v5.10.0 (10/08/21)

Latest update:

  • updated: Contextual help can now be controlled programatically to close the contextual help box/modal.
  • fixed: Issues where icons jumping rather than animating when triggered, and were not displaying correctly in Firefox.

Full version history

A full history of changes and enhancements detailing all minor and major updates to the component.

View full version history

Want something new in Framework, or to chat about an issue you're having with it?

Contact the team