• Molecule
  • CORE COMPONENT
  • Taxonomic name: M-SITE-SWITCHER
  • Added on: v4.8.0 (29/03/19)
  • Updated on: v5.5.0 (23/03/21)

Site switcher

For switching between two and six alternative websites, for example Personal, Business and Corporate.


Design and usage

There are two variations of the site switcher:

  • Two tabs with short labels which are both always visible within the masthead top bar.
  • Two to six options contained within a single dropdown link within the masthead top bar; these can also have additional support text with them.

Examples

Tabbed site switcher (two options)

Structure

  • Background colour of black bar is #111
  • Site switcher selected/current site has a background of #EFEFEF
  • Site switcher link has a background hover state of #444444 - Body copy grey
  • Copy within the labels must not cause the tabs to wrap at mobile
  • Only for use with two options

Placement

  • Can only be used with the masthead black bar
  • Black bar containing the optional:

Use case

  • Should only be used to switch between pages/sites and is not to be used for updating page content

Interactive example

Code example

Place the code for country and site selector within header on page

<div class="m-site-country-selection">
	<div class="l-content-container">
		<ul class="a-list-plain m-site-country-selection__site-list">
			<li><a href="...">...</a></li>
			<li><span>...</span></li>
		</ul>
		<p class="m-site-country-selection__country [ Modifier ]"><a href="..." aria-label="... - select alternative country site">...</a></p>
	</div>
</div>

See masthead/main navigation for full masthead markup

Show/hide site switcher (Two to six options)

Structure

  • Background colour of black bar is #111
  • Site switcher link has a background hover state of #444 - Body copy grey
  • Site switcher link text is vertically aligned with the content below (causes the hover state to extend 10px off the grid)
  • The site switcher can be closed by clicking the button used to open it
  • Content can contain:

    • A heading group (H2 semi-bold and H3 light #FFF - white)
    • 2-6 transparent buttons
    • Body copy and inline link (#FFF - white)
    • Body copy above the buttons (only for use with the 2-4 column structure)
  • All standard vertical padding rules apply
  • The copy that sits above the buttons is restricted to 80 characters
  • Note: Minimum requirement for use is 2 buttons, all other elements are optional
  • Note: The H3 in the heading group is also optional
Dropdown link text
  • Site switcher link copy has a maximum limit of 70 characters
  • Arrow must not wrap onto a third line
  • Country selector retains its position when the site switcher link wraps
  • Copy changes after selection has been made from the site switcher to show selected option
  • Standard colour for the site switcher link is #FFF - white
  • Selected text can change to #FFD900 (Abeille Assurances yellow) if needed (see highlight selected option example)

Non-JS requirements and considerations

  • The site switcher button links to the black bar content at the bottom of the page
  • The content sits above the footer and has a #333 colour background, a #444 (body copy grey) key line divides the content from the footer content
  • A H3 semi-bold #FFF (white) label sits above the content explaining that it's the site switcher if a heading group has not been included

Accessibility and screen readers

  • Inclusion of appropriate level headings to aid in understanding of the component whilst using assistive technologies. Although these headings do not follow the correct nesting order once JavaScript has run, they do not constitute a failure of WCAG 1.3.1 as specified within WCAG technique H42 - example 2. This component is an exception to maintaining the heading order as removal of the headings would cause failure of WCAG 1.3.1 due to content being styled as headings but not marked up as headings, as well as detrementing any assistive technology users.

Placement

  • Can only be used with the masthead black bar

Use case

  • Should only be used to switch between pages/sites and is not to be used for updating page content

Animation

  • All animations have an ease-in-out applied
  • Opening the navigation:

    • The yellow navigation bar and black bar animate first over 0.3 seconds
    • After a 0.2 second delay the content fades in over 0.2 seconds
  • Closing the navigation:

    • The content fades out first over 0.2 seconds
    • After a 0.1 second delay the yellow navigation bar and black bar animate back to their original positions over 0.3 seconds
  • Clicking a transparent button automatically closes the site switcher (same rules apply as for closing the animation)

Interactive example

Code example

Place the code for country and site selector within header on page

<div class="m-site-country-selection">
	<div class="l-content-container">
		<p class="m-site-country-selection__site-switcher"><a href="#...">Site switcher</a></p>
		<p class="m-site-country-selection__country [ Modifier ]"><a href="..." aria-label="... - select alternative country site">...</a></p>
	</div>
</div>

See masthead/main navigation for full masthead markup

Highlight selected option

Example layout options

Maximum of 6 buttons can be used within the site switcher.

Interactive example

Code example

Code to be placed directly prior to the footer

<div class="m-site-switcher t-accent-dark" id="...">
	<div class="l-content-container">
		<h2 class="a-heading a-heading--3 u-margin--top-none m-site-switcher__heading">Site switcher</h2>
		<ul class="m-button-group">
			<li class="m-button-group__item"><a class="a-button a-button--transparent m-site-switcher__selected-option is-disabled" aria-current="true" href="..." data-value="...">...</a></li> <!-- Current website/selected website -->
			<li class="m-button-group__item"><a class="a-button a-button--transparent" href="..." data-value="...">...</a></li>
			...
		</ul>		<!-- Optional paragraph -->
		<p>...</p>
	</div>
</div>
<!-- footer -->

When using the heading group the sub-heading is optional.

Interactive example

Code example

Code to be placed directly prior to the footer

<div class="m-site-switcher t-accent-dark" id="...">
	<div class="l-content-container">
		<div class="m-heading-group u-margin--top-none">
			<h2 class="a-heading m-heading-group__item a-heading--2 a-heading--semibold">...</h2>
			<h3 class="a-heading m-heading-group__item a-heading--3 a-heading--light">...</h3>
		</div>
		<ul class="m-button-group">
			<li class="m-button-group__item"><a class="a-button a-button--transparent m-site-switcher__selected-option is-disabled" href="..." data-value="...">...</a></li> <!-- Current website/selected website -->
			<li class="m-button-group__item"><a class="a-button a-button--transparent" href="..." data-value="...">...</a></li>
			...
		</ul>		<!-- Optional paragraph -->
		<p>...</p>
	</div>
</div>

2, 3 or 4 columns can be used when you need to add description copy to the buttons.

Interactive example

Code example

<div class="m-site-switcher t-accent-dark" id="...">
	<div class="l-content-container">
		<div class="m-heading-group u-margin--top-none">
			<h2 class="a-heading m-heading-group__item a-heading--2 a-heading--semibold">...</h2>
			<h3 class="a-heading m-heading-group__item a-heading--3 a-heading--light">...</h3>
		</div>
		<div class="l-columns l-columns--2-medium l-columns--4-large">
			<div class="l-columns__column">
				<p>...</p>
				<p><a class="a-button a-button--transparent m-site-switcher__selected-option is-disabled" href="..." data-value="...">...lt;/a></p>
			</div>
			<div class="l-columns__column">
				<p>...</p>
				<p><a class="a-button a-button--transparent" href="...">...</a></p>
			</div>
			<div class="l-columns__column">
				<p>...</p>
				<p><a class="a-button a-button--transparent" href="...">...</a></p>
			</div>
			<div class="l-columns__column">
				<p>...</p>
				<p><a class="a-button a-button--transparent" href="...">...</a></p>
			</div>
		</div>		<!-- Optional paragraph -->
		<p>...</p>
	</div>
</div>

Development and test

Notes for developers

Optional to include but should only be used for the very highest level categories such as Personal / Business.

Tabbed site switcher (two options)

Be aware there is very limited space at mobile and any options within this area must be able to fit of screens from 300px wide.

Show/hide site switcher (Two to six options)

Ensure the site switcher content is placed directly before the footer and after any masthead links.

The site switcher area must always have an H2 included, this can either be a heading group or an H2 that is hidden when JavaScript runs by adding the class m-site-switcher__heading.

The JavaScript for the masthead must be loaded for this site switcher to function correctly.

Each button must have data-value set with the text that is required when the option is selected. The text is applied to the switcherSelection locale setting text where {option} is included ie. if the value text was "Broker" and the locale value was "You are on {option}" the resulting text seen by the user would be "You are on Broker".

To highlight the site name within the top bar include data-highlight="true" on the m-site-switcher div.

Changing locale settings

Default close text for the main menu link can be changed for a particular locale.

en: {
oMasthead : {
	closeText : 'Close',
	loadingText : 'Please wait',
	switcherInitial : 'Select your preferred option',
	switcherSelection : 'You are on {option}',
},
},

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


Notes for testers

When JavaScript is available ensure that the site switcher can be opened via both mouse and keyboard and that all links within the site switcher can then be accessed in the same way.

With JavaScript and a navigation panel open, ensure that if navigating via a keyboard the user remains within the masthead and navigation panel (Can not tab to elements within the rest of the page).

When JavaScript is available if any masthead link is opened the site switcher must be automatically closed.

Ensure that when navigating by keyboard that it is clear which link currently has focus.


Classes overview

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

Class Outcome Required Applied to Comments
.m-site-country-selection Base style for bar that sits above the masthead containing site switcher and country selector Yes (if section included) header > div  
.m-site-country-selection__site-list Base styling for tabbed site switcher link list Yes (if tabbed site switcher included) .m-site-country-selection > .l-content-container > ul.a-list-plain  
.m-site-country-selection__site-switcher Base styling for show/hide site switcher link Yes (if show/hide site switcher included) .m-site-country-selection > .l-content-container > p  
.m-site-switcher Base styling for show/hide site switcher content Yes (if show/hide site switcher included) div Place directly before the footer
.m-site-switcher__heading Base styling for site switcher heading for when a heading group has not been used so that the heading is hidden when JavaScript runs   .m-site-switcher > .l-content-container > h2 The heading should also have the following classes applied: a-heading a-heading--3 u-margin--top-none
.m-site-switcher__selected-option Modifer and setting style for use on the button that links/is connected to the current site the user is on, so that the button is clearly highlighted and not interactable.   .m-site-switcher > .l-content-container .a-button.a-button--transparent The button should also have the class is-disabled applied. If a button element is used rather than an anchor tag ensure that the disabled attribute is also set on the button.

Keyboard operations

TAB

Tabbing to a link should make the link clearly visually different so that the focus point on the page is obvious to the user.

Enter

When JavaScript is available hitting enter on show/hide site switcher link should open the site switcher panel if it is not already open, otherwise it should close the panel.

Component releases

  • Added on: v4.8.0 (29/03/19)
  • Updated on: v5.5.0 (23/03/21)

Latest update:

  • updated: The colour of the border and the active background on the transparent buttons within the site switcher has been updated from #888 to #737373, to provide better consistency in the colours used within Framework.

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