To best utilize the store launchpads for your customers, we recommend some best practices for accessibility.
Making your website accessible ensures it can be used by a larger, more diverse audience and improves the user experience for all your customers. In turn, this can also enhance your brand reputation and improve your search engine optimization (SEO) metrics.
It is your responsibility to ensure ongoing compliance with accessibility regulations in the respective countries that you operate.
When using or amending the store launchpad codebase, remember the following accessibility best practices.
Give pages informative titles
<title>
element with useful text that reflects the content of the page.For example, the default title of the Orders page of the B2B Store Launchpad for Manufacturing is:
<title>Orders - The B2B Store</title>
Give links discernible text
aria-label
to describe what the link is for screen readers. For example:<Link aria-label="My Account" href={accountLink.href}>
<UserCircleIcon className="w-6 text-gray-700 lg:w-5" />
</Link>
Make sure all input fields have labels
Fields that require a user to enter text or other data must have descriptive labels to ensure the user understands the purpose of the field and so that screen readers can read the text.
<label>
element. For example:<label htmlFor="email">Email Address</label>
<input type="email" id="email" name="email" required />
aria-label
or the aria-labelledby
element instead. For example:<input type="text" aria-label="Search" placeholder="Search..." />
Give clickable components a minimum touch target size
Small clickable elements can be difficult to interact with, especially on touch devices. All clickable components on your website should have a minimum touch target size of 24x24px. This reduces the chances of accidentally clicking the wrong component, which improves accessibility and user experience. For example:
<Link className="p-2" href={href}>{name}</Link>
Consider the accessibility of styled components
<div>
, <span>
, or other non-semantic HTML elements may not be accessible to customers who rely on screen readers or solely on keyboards. To improve accessibility, you can do the following:- Assign the appropriate ARIA roles to mimic HTML elements, such as
role="combobox"
for a styled dropdown orrole="radio"
for a custom radio button. - Enable keyboard navigation that uses the
Tab
andArrow
keys for moving focus across the page, andEnter
orSpace
for selecting the relevant elements.
The following example shows a custom-styled combobox that uses the ARIA role element:
<div
role="combobox"
aria-haspopup="listbox"
aria-expanded="false"
tabindex="0"
onKeyDown="handleKeyDown"
>
<span>Select an option</span>
<div role="listbox" tabindex="-1">
<div role="option" tabindex="0">Option 1</div>
<div role="option" tabindex="0">Option 2</div>
</div>
</div>
role="checkbox"
or role="radio"
ARIA role element. Use the aria-checked
attribute to manage if the user has selected the checkbox or button. For example:<label role="checkbox" tabindex="0" aria-checked="false">
<span class="checkbox-icon"></span> Accept Terms
</label>
Use the logical heading structures
Headings should be used to create a clear, logical outline of your content with concise, descriptive text that lets users scan it easily.
<h1>
to <h6>
in a hierarchical order. The <h1>
tag should indicate the main title of the page and therefore typically is only used only once per page. Subsequent headings (<h2>
to <h6>
) should be used for subheadings, sections, and subsections within the content.<h2>
followed by a <h4>
for the next section, and don't use headings for purely stylistic purposes.large-title
, medium-title
, or small-title
.An example of a hierarchical content structure using HTML header tags is as follows:
<h1>Main Page Title</h1>
<h2>Section 1</h2>
<p>Content for section 1.</p>
<h3>Subsection 1.1</h3>
<p>Content for subsection 1.1.</p>
<h3>Subsection 1.2</h3>
<p>Content for subsection 1.2.</p>
<h2>Section 2</h2>
<p>Content for section 2.</p>
Use the minimum recommended contrast ratios
Insufficient contrast between text and background makes content difficult to read for users with visual impairments, such as those with low vision or color blindness. While contrast requirements may vary based on the design and color scheme of your website, aim to follow WCAG guidelines and maintain a contrast ratio of at least 4.5:1 for normal text and 3:1 for large text.
To ensure your site meets these requirements, consider doing the following:
- Test color contrast against your site's specific design.
- Use accessibility testing tools to verify contrast levels.
Test the accessibility of your site
Use the following tools during your design stage to assess how accessible your website is:
- Accessibility Insights: for automated testing against WCAG guidelines and checks for keyboard and screen reader support.
- WebAIM Contrast Checker: for checking that text and background contrast is compliant with WCAG standards.
Use the following tools during your development stage to to test the accessibility of your site:
- WAVE Web Accessibility Evaluation Tool browser extension: a browser extension that highlights contrast issues, missing alt text, and ARIA errors.
- Axe Accessibility Scanner: a tool that integrates into development workflows to provide you with detailed accessibility reports.
- Google Lighthouse: a tool that assesses contrast levels, keyboard navigation, and screen reader compatibility.