SlideShare a Scribd company logo
Accessible
How to build
UI Components
For this presentation, 

I’m going to outline seven criteria
that can be used to make accessible
UI components.
Then, I’ll show you an example UI
component built using three different
methods.
Finally, I’ll use the seven criteria to
determine the accessibility of each
method.
Seven criteria that make
a UI component
accessible
1. Semantics
All HTML elements have specific
semantic meaning.
Where possible, HTML elements
should be used for their intended
purpose only.
Using HTML elements incorrectly can
cause confusion for Assistive
Technologies.
If an element is being used in a
different way to its intended purpose,
it should be assigned an explicit
ARIA role.
// This div element is being used as a button, so it
will need a role of "button", so that its purpose is
understood by assistive technologies:
<div role="button"></div>
2. Accessible name
Many HTML elements have an
accessible name already defined.
Accessible names are used by
Assistive Technologies to identify the
element.
Accessible names can come from
different sources, including:
// By default, the accessible name for links is
defined via the link content:
<a href="a.html">Red fish</a>
// The accessible name for images is defined via the
value of the alt attribute (if present):
<img src="a.png" alt="Red fish">
// The accessible name for form controls can be
defined via the label content, if these two elements
are explicitly associated:
<label for="fish">Red fish</label>
<input id="fish" type="text">
For some UI components, there is no
accessible name, or the existing
name lacks clarity.
In these cases, specific ARIA
attributes can be used to provide a
new accessible name.
// If the button content lacks meaning, the
accessible name can be defined via the aria-label
value:
<button aria-label="Close and go to Red fish">

X

</button>
3. Focusable
Interactive UI components must be
able to receive keyboard focus.
If the UI component is built using
elements that don’t natively accept
focus, some of these elements will
need to have focus defined.
For simple components, this could
mean adding tabindex="0" to the
parent component.
For more complex components, this
could mean adding focus to a range
of child elements.
4. Keyboard interaction
Interactive UI components must be
fully accessible using keystrokes
only.
These keystrokes should follow well-
established keystroke patterns.
5. Visible states
Interactive UI components have a
range of possible states.
These states can include hover,
focus, active and in some cases,
checked.
Each of these states should be clearly
visible.
Each of these states should have a
unique style.
6. Functional states
Interactive UI components may need
to change states at times.
States can include checked,
expanded, disabled, pressed and
selected.
These states must be clearly
communicated to assistive
technologies.
For native HTML elements like radio
and checkboxes, these states are
baked-in.
However, when using non-native
elements, ARIA has to be used to
define these states.
// In this case, a DIV element has been given an
aria-checked attribute to inform assistive
technology users of its state:
<div
checked
aria-checked="true"
>
</div>
7. Existing UI conventions
UI components should be designed to
work in well-established ways.
Reinventing the wheel can cause
confusion for users.
This is especially important for certain
types of cognitive-impaired and
technically challenged users.
Non-native UI components should be
tested rigorously with the intended
audience.
One UI component,
three methods
Let’s look at our UI component.
Red
Green
Blue
Purple
Yellow
Choose your preferred colours
Heading
Red
Green
Blue
Purple
Yellow
Choose your preferred colours
A set of options
Red
Green
Blue
Purple
Yellow
Choose your preferred colours
One or more options can be checked
Over the years, I’ve seen this problem
tackled using a range of different
methods.
We’ll look at three common
methods.
Method 1.

Using checkboxes
Red
Green
Blue
Purple
Yellow
Choose your preferred colours
Fieldset
Choose your preferred colours
Red
Green
Blue
Purple
Yellow
Legend - explicitly associates

heading with options below
Red
Green
Blue
Purple
Yellow
Choose your preferred colours
Native checkboxes
Red
Green
Blue
Purple
Yellow
Choose your preferred colours
Labels
Red
Green
Blue
Purple
Yellow
Choose your preferred colours
Checkboxes and labels are

explicitly associated via

matching “for” and “id” values
1. Semantics:
2. Accessible name:
3. Focusable:
4. Keyboard interaction:
5. Visible states:
6. Functional states:
7. Existing conventions:
Baked in

Baked in

Baked in

Baked in

Baked in

Baked in

Well known/understood
This method is highly accessible.
Method 2.

Using checkboxes styled to
look like buttons
Choose your preferred colours
Heading
Red Green Blue
Purple Yellow
Choose your preferred colours
Red Green Blue
Purple Yellow
A set of options
Choose your preferred colours
Red Green Blue
Purple Yellow
One or more options can be checked
Choose your preferred colours
Red Green Blue
Purple Yellow Fieldset
Choose your preferred colours
Red Green Blue
Purple Yellow
Legend - explicitly associates

heading with options below
Choose your preferred colours
Red Green Blue
Purple YellowHidden Checkboxes
Choose your preferred colours
Red Green Blue
Purple YellowLabels placed on top of the checkboxes
Choose your preferred colours
Red Green Blue
Purple Yellow
LabelCheckboxes and labels are

explicitly associated via

matching “for” and “id” values
1. Semantics:
2. Accessible name:
3. Focusable:
4. Keyboard interaction:
5. Visible states:
6. Functional states:
7. Existing conventions:
Baked in

Baked in

Baked in

Baked in

Baked in

Baked in

May not be understood
This method does not use existing UI
conventions.
It changes the appearance of
checkboxes to make them appear
like buttons.
The default nature of buttons is that
they can be pressed to trigger some
sort of action.
By default, buttons do not have a
checked state.
For this reason, users may not
understand when an option is
checked.
They also may not understand that
they can choose multiple options.
So, this method should be tested
carefully with the intended audience
before being used.
Method 3. 

Using buttons
Choose your preferred colours
Heading
Red Green Blue
Purple Yellow
Choose your preferred colours
Red Green Blue
Purple Yellow
A set of options
Choose your preferred colours
Red Green Blue
Purple Yellow
One or more options can be checked
No Fieldset
Choose your preferred colours
Red Green Blue
Purple Yellow
Choose your preferred colours
Red Green Blue
Purple Yellow
No Legend, so heading is not explicitly

associated with options below
No Checkboxes
Choose your preferred colours
Red Green Blue
Purple Yellow
Choose your preferred colours
Red Green Blue
Purple Yellow
Buttons
1. Semantics:
2. Accessible name:
3. Focusable:
4. Keyboard interaction:
5. Visible states:
6. Functional states:
7. Existing conventions:
Will need to be defined

Baked in

Baked in

Will need to be redefined

Will need to be redefined

Will need to be defined

May be misunderstood
This method starts out using an
entirely inappropriate element - the
<button> element.
Extensive work would need to be
done to make this component
accessible.
// The button would need to be given a role of
checkbox, to inform Assistive Technologies as to its
purpose.
<button
role="checkbox"
>
Green
</button>
// When checked, the button would need to be given
an aria-checked attribute, to inform Assistive
Technologies as to its current state.
<button
role="checkbox"
checked
aria-checked="true"
>
Green
</button>
This method also has similar problems
to the previous method. It does not
use existing UI conventions.
So, this method would also need to
be tested with the intended
audience before being used.
Conclusion
The main lesson here is that we
should always try to use native
HTML elements for UI components.
Accessibility is baked into every
aspect of these elements - from
semantics to accessible name,
keyboard functionality, states and
more.
The further away from native HTML
elements you move, the more work
you have to put in to try and force
them to operate in an accessible way.
Thank you

More Related Content

PDF
Accessible states in Design Systems
PDF
Creating accessible modals and autocompletes
PDF
What are accessible names and why should you care?
PDF
Accessibility in Design systems - the pain and glory
PDF
Accessible Inline errors messages
PDF
Accessible custom radio buttons and checkboxes
PDF
Building Accessible Web Components
PDF
Building accessible web components without tears
Accessible states in Design Systems
Creating accessible modals and autocompletes
What are accessible names and why should you care?
Accessibility in Design systems - the pain and glory
Accessible Inline errors messages
Accessible custom radio buttons and checkboxes
Building Accessible Web Components
Building accessible web components without tears

What's hot (20)

PDF
Creating Acessible floating labels
PDF
Accessible modal windows
PDF
aria-live: the good, the bad and the ugly
PDF
Creating an Accessible button dropdown
PPT
android layouts
PDF
Front End Frameworks - are they accessible
PPTX
Android development session 3 - layout
PDF
Homework seriesandroidworkshop JUly 12th
PPT
Android UI Patterns
PDF
AutoCorrect - Excel 2013 Tutorial
PDF
Android Homework for-july-19th-2015
PDF
Android ui layout
PPTX
Tugas testing
DOC
V2vdata
PDF
Android layouts
PDF
Access tips access and sql part 6 dynamic reports
PDF
Access tips access and sql part 4 building select queries on-the-fly
DOCX
How to create ui using droid draw
PPTX
Chapter 3 — Program Design and Coding
PPTX
Introduction To Excel 2007 Macros
Creating Acessible floating labels
Accessible modal windows
aria-live: the good, the bad and the ugly
Creating an Accessible button dropdown
android layouts
Front End Frameworks - are they accessible
Android development session 3 - layout
Homework seriesandroidworkshop JUly 12th
Android UI Patterns
AutoCorrect - Excel 2013 Tutorial
Android Homework for-july-19th-2015
Android ui layout
Tugas testing
V2vdata
Android layouts
Access tips access and sql part 6 dynamic reports
Access tips access and sql part 4 building select queries on-the-fly
How to create ui using droid draw
Chapter 3 — Program Design and Coding
Introduction To Excel 2007 Macros
Ad

Similar to How to build accessible UI components (20)

PPTX
PPTX
HTML Forms: The HTML element represents a document section containing interac...
PDF
5 Most Common User Experience Mistakes and How to Avoid Them
PPTX
BEX.pptx
PDF
2. HTML forms
PPTX
5 free tools for web accessibility testing
PPTX
#42 green lantern framework
PPTX
html forms
PPT
20-html-forms.ppt
PDF
UI_UX_testing tips
PPTX
[UX Series] 1b - 12 standard screen layouts
PDF
c05_rac_2023.pdf
PPT
HtmlForms- basic HTML forms description.
PDF
Implementing Inclusive Interfaces
PPS
Project Fusion Reference Guide V2
PPT
Checking the "Feel" of your UI with an Interaction Audit
PPT
Checking the "Feel" of your UI with an Interaction Audit
PPT
05 html-forms
PPTX
introduction to Data Base Forms and reports.pptx
PPTX
SFDC Training Day 2SFDC Training Day 2.pptx
HTML Forms: The HTML element represents a document section containing interac...
5 Most Common User Experience Mistakes and How to Avoid Them
BEX.pptx
2. HTML forms
5 free tools for web accessibility testing
#42 green lantern framework
html forms
20-html-forms.ppt
UI_UX_testing tips
[UX Series] 1b - 12 standard screen layouts
c05_rac_2023.pdf
HtmlForms- basic HTML forms description.
Implementing Inclusive Interfaces
Project Fusion Reference Guide V2
Checking the "Feel" of your UI with an Interaction Audit
Checking the "Feel" of your UI with an Interaction Audit
05 html-forms
introduction to Data Base Forms and reports.pptx
SFDC Training Day 2SFDC Training Day 2.pptx
Ad

More from Russ Weakley (17)

PDF
Accessible chat windows
PDF
Accessible names & descriptions
PDF
A deep dive into accessible names
PDF
What is WCAG 2 and why should we care?
PDF
Building an accessible progressive loader
PDF
Accessible Form Hints and Errors
PDF
What is accessibility?
PDF
Accessibility in Pattern Libraries
PDF
Accessibility in pattern libraries
PDF
Building an accessible auto-complete - #ID24
PDF
Building an accessible auto-complete
PDF
Creating a Simple, Accessible On/Off Switch
PDF
Deep Dive into Line-Height
PDF
Understanding the mysteries of the CSS property value syntax
PDF
Specialise or cross-skill
PDF
CSS pattern libraries
PDF
Responsive Web Design - more than just a buzzword
Accessible chat windows
Accessible names & descriptions
A deep dive into accessible names
What is WCAG 2 and why should we care?
Building an accessible progressive loader
Accessible Form Hints and Errors
What is accessibility?
Accessibility in Pattern Libraries
Accessibility in pattern libraries
Building an accessible auto-complete - #ID24
Building an accessible auto-complete
Creating a Simple, Accessible On/Off Switch
Deep Dive into Line-Height
Understanding the mysteries of the CSS property value syntax
Specialise or cross-skill
CSS pattern libraries
Responsive Web Design - more than just a buzzword

Recently uploaded (20)

PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PDF
RMMM.pdf make it easy to upload and study
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PPTX
Pharma ospi slides which help in ospi learning
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PPTX
Lesson notes of climatology university.
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
VCE English Exam - Section C Student Revision Booklet
PPTX
Cell Types and Its function , kingdom of life
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPTX
GDM (1) (1).pptx small presentation for students
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
Computing-Curriculum for Schools in Ghana
O7-L3 Supply Chain Operations - ICLT Program
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
2.FourierTransform-ShortQuestionswithAnswers.pdf
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
RMMM.pdf make it easy to upload and study
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Pharma ospi slides which help in ospi learning
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
Lesson notes of climatology university.
O5-L3 Freight Transport Ops (International) V1.pdf
Supply Chain Operations Speaking Notes -ICLT Program
VCE English Exam - Section C Student Revision Booklet
Cell Types and Its function , kingdom of life
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
GDM (1) (1).pptx small presentation for students
Microbial diseases, their pathogenesis and prophylaxis
Final Presentation General Medicine 03-08-2024.pptx
Computing-Curriculum for Schools in Ghana

How to build accessible UI components