• Organism
  • CORE COMPONENT
  • Taxonomic name: O-FAQ-PANEL
  • Extension: ADDITIONAL-HELP
  • Added on: v3.3.0 (27/04/18)
  • Updated on: v5.10.0 (10/08/21)

FAQ panel

FAQ panels are designed to display between two and five frequently asked questions within a full width panel on a page for easy reference.


Design and usage

Placement

Structure

  • Questions can take up to a maximum of 3 lines on mobile, and a maximum of 2 lines on desktop and tablet.
  • Answers on mobile: if the answer is equal or less than 5 lines, it is displayed in full. For longer answers, use ellipsis to finish the paragraph.
  • Answers on tablet and desktop: if the answer is equal or less than 2 lines, itis displayed in full. For longer answers use ellipsis to finish the paragraph.
  • When needed, a text link to Show more is displayed, allowing users to expand the answer and see the rest of the content. Once the content is expanded, Show more becomes Show less.
  • Answers have no restriction on length, however, it must be as clear and short as possible (recommend maximum of 2 paragraphs).
  • Answers can contain text links, ordered and unordered lists as long text links if required.
  • Minimum number of questions for an FAQ section is 2. If the number is higher than 5, a secondary CTA to "View more FAQs" is displayed. However, in certain case (ie. Q&B), it would not be good practice to send the users to another page, so the CTA can be removed in this instance.
  • Answers can contain molecules and organisms other than body copy, such as graphical elements, tables, data group, cards etc.
  • Copy line length conforms to our usual rules, ie. desktop 9 columns, tablet 7 columns, mobile 4 columns. Alternative content is nott similarly constrained and can span the full width of its container if required to do so.
  • No acronyms should be used for section titles, they must be self-descriptive, ie. 'Frequently Asked Questions' rather than 'FAQs'.
  • Lazy loading methods cannot be used with this organism.

Labels

  • Title must read 'Frequently Asked Questions' or translated equivalent.
  • Title is a H2-semi-bold font.
  • Changing the font size or weight.
  • Title abbreviated to 'FAQs'.

Non-JS requirements and considerations

  • When JavaScript is disabled/unavailable, all the questions and answers are expanded by default and the control "Show more" should not be available.

Examples

Frequently Asked Questions panel: standard variant

Interactive example

Code example

<div class="o-faq-panel" data-module="o-faq-panel">
	<h2 class="a-heading a-heading--2 [ Modifier ] o-faq-panel__title">Frequently Asked Questions</h2>
	<div class="o-faq-panel-item">
		<h3 class="a-heading a-heading--3 [ Modifier ] o-faq-panel-item__question">...</h3>
		<div class="o-faq-panel-answer">
			...
		</div>
	</div>
	...
	<div class="o-faq-panel__more-questions">
		<a class="a-button a-button--secondary" href="...">View more questions</a>
	</div>
</div>

Frequently Asked Questions panel: standard variant with data description to interpret the purpose of the link

Interactive example

Code example

<div class="o-faq-panel" data-module="o-faq-panel">
	<h2 class="a-heading a-heading--2 [ Modifier ] o-faq-panel__title">...</h2>
	<div class="o-faq-panel-item">
		<h3 class="a-heading a-heading--3 [ Modifier ] o-faq-panel-item__question">...</h3>
		<div class="o-faq-panel-answer" data-description="...">
			[object]
		</div>
	</div>
	<div class="o-faq-panel-item">
		...
	</div>
</div>

Development and test

Notes for developers

  • FAQ panels panels should be used on light accent colours only.
  • The first element within the .o-faq-panel-answer div will ideally be a standard unstyled <p> with no markup tags within it (as these may be cropped by the truncation script); if the initial element is not a paragraph, all content will be hidden and replaced by a Show more link.
  • Do not use more than one FAQ panel per page.
  • Use a minimum of 2 and maximum of 5 questions per panel; if more than five questions are requested, a separate page should be used, so refer the case back to your user experience team.

Be sure to check correct usage with user experience team before proceding, to ensure that the correct variant (standard or right hand side) is being used for this instance.

A data-description tag must be used where a descriptive link is required, for example where there is very little text or an object/image/chart/table or list begins the content so there is nothing to interpret the purpose of the link. Description data is combined with the text link and presented as an aria-label.

It must be positioned at the same level as the FAQ answer.

<div class="o-faq-panel-answer" data-description="...">

Rerunning truncate function

If additional FAQs need to be added into the panel on the fly, then the function to scan, truncate and resize the panel has been exposed so it can be rerun. Appropriate markup will need to created and inserted into the correct point in the DOM, but can then the event update must be called on the element containing the data-module attribute.

Example using the utility functions available.

utility.trigger( '[ID or class of div including data-module call ]', 'update' );

Visible labels and accessible names

The Read more links used to link to copy on external pages must contain an extra span with the class u-hidden--visually within the a-button__inner to hold the hidden text required to make the accessible name for the label meaningful to screen readers. The visible label should always come first, with the hidden text following on to extend this by adding meaning and context, for example:

<span class="a-button__inner">Read more<span class="u-hidden--visually"> about [question]</span></span>

This also helps to ensure that all buttons and links are unique through the page, rather than having multiple instances of links simply saying "Read more".

Controling the FAQ panel component programatically

FAQ panel can be controlled programatically to open/close a single FAQ or open/close all open FAQs. The following methods are available for use:

Method Description
open( '#faqId' ) Open one FAQ item via the id on the o-faq-panel-item.
openAll() Open all closed FAQs within the FAQ panel.
close( '#faqId' ) Close one FAQ item via the id on the o-faq-panel-item.
closeAll() Close all open FAQs within the FAQ panel.

For example:

document.addEventListener( 'frameworkready', function () {
	FRAMEWORK.require([ 'blocks/o-faq-panel' ], function ( oFaqPanelModule ) {
		var oFaqPanelEl = document.querySelector( '#faqGroupId' ),
			oFaqPanelInstance = oFaqPanelModule.initInstance( oFaqPanelEl );		oFaqPanelInstance.close( '#faqId' );
	});
});

Changing locale settings

Locale settings will need to be updated to include appropriate translations for the 'Show more' and 'Show less' links.

en: {
	oFaqPanel : { showMore : 'Show more' },
},

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

Extension component

This component forms part of the 'additional-help' extension and so requires an additional stylesheet to be loaded in order to be used; include the following code in the header of your page to attach the relevant additional stylesheet:

<link media="all" href="./assets/[ theme type ]/[ release version ]/[ organisation ]/[ theme name ]/css/additional-help.css" rel="stylesheet" />

Notes for testers

Be sure to pay extra attention to breakpoints and screen sizes given the amount of content that the organism could contain; this shouldn't be an issue, but targeted checks to ensure that resizing doesn't compromise content layout are essential.


Classes overview

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

Class Outcome Required Applied to Comments
.o-faq-panel Base style for FAQ panel organism Yes div  
o-faq-panel__title FAQ panel main title Yes .o-faq-panel  
.o-faq-panel-item FAQ panel question/answer pair item Yes .o-faq-panel  
.o-faq-panel-item__question FAQ panel item question Yes .o-faq-panel-item  
.o-faq-panel-answer FAQ panel item answer Yes .o-faq-panel-item  
.o-faq-panel-answer__fullwidth Style for forcing FAQ panel answer to fit full width (rather than default 75%) at tablet and desktop   .o-faq-panel-answer > *  
.o-faq-panel__read-more Style for Read more link in item answer   .o-faq-panel-answer > a-button a-button--tertiary  
.o-faq-panel__more-questions Style for div holding View more questions button   .o-faq-panel > div  

Component releases

  • Added on: v3.3.0 (27/04/18)
  • Updated on: v5.10.0 (10/08/21)

Latest update:

  • updated: FAQ panels can now be controlled programatically to open/close a single FAQ or open/close all open FAQs

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