Skip to content

Commit 901357b

Browse files
committed
fix: finalize
1 parent 0b76cc0 commit 901357b

File tree

9 files changed

+376
-113
lines changed

9 files changed

+376
-113
lines changed

.vitepress/config.mts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@ export default defineConfig({
1111
items: [
1212
{ text: "Introduction", link: "/intro" },
1313
{ text: "WAI-ARIA", link: "/wai-aria" },
14-
{ text: "Semantic HTML", link: "/semantic-html" },
15-
{ text: "Accessible Form", link: "/accessible-forms" },
14+
// { text: "Semantic HTML", link: "/semantic-html" },
15+
// { text: "Accessible Form", link: "/accessible-forms" },
1616
{ text: "Visibility Methods", link: "/visibility-methods" },
1717
// { text: "Accessible Multimedia", link: "/multimedia" },
18-
{ text: "Focus Control", link: "/focus-control" },
18+
// { text: "Focus Control", link: "/focus-control" },
1919
// {
2020
// text: "Mouse and Pointer Events",
2121
// link: "/mouse-and-pointer-events",
2222
// },
2323
{ text: "Complex Widgets", link: "/complex-widgets" },
24-
{ text: "Development Checklists", link: "/dev-checklists" },
2524
{ text: "Tools", link: "/tools" },
25+
{ text: "Development Checklists", link: "/dev-checklists" },
2626
{ text: "Exercise", link: "/exercise" },
2727
{ text: "References", link: "/references" },
2828
],
@@ -31,5 +31,8 @@ export default defineConfig({
3131
socialLinks: [
3232
{ icon: "github", link: "https://github.com/code-with-amirhossein" },
3333
],
34+
footer: {
35+
message: 'Created with <span class="heart">♥️</span> by <a href="https://github.com/amir78729" target="_blank">Amirhossein</a>',
36+
},
3437
},
3538
});

.vitepress/theme/custom.css

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,35 @@
1313
iframe {
1414
width: 100%;
1515
}
16+
17+
.heart {
18+
display: inline-block;
19+
animation: heartbeat 1s infinite;
20+
}
21+
22+
@keyframes heartbeat {
23+
0% {
24+
transform: scale(0.85);
25+
}
26+
20% {
27+
transform: scale(1);
28+
}
29+
40% {
30+
transform: scale(0.85);
31+
}
32+
60% {
33+
transform: scale(1);
34+
}
35+
80% {
36+
transform: scale(0.85);
37+
}
38+
100% {
39+
transform: scale(0.85);
40+
}
41+
}
42+
43+
@media (prefers-reduced-motion: reduce) {
44+
.heart {
45+
animation: none;
46+
}
47+
}

dev-checklists.md

Lines changed: 98 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,18 @@ outline: "deep"
1717

1818
# Development Checklists
1919

20-
![Image of the spider-man with triggered spider-sense](./assets/spider-sense.jpg)
20+
<!-- ![Image of the spider-man with triggered spider-sense](./assets/spider-sense.jpg) -->
2121

22-
23-
There are a number of tools we can use to assist in the creation of accessible web applications.
22+
There are a number of tools we can use to assist in the creation of accessible web applications.
2423

2524
Here are some common issues that should make your spidey senses go off. My goal is for you to be able to identify these in code reviews and demos.
2625

2726
We want to bring kindness to these situations and not judge people. We also need to identify accessibility issues (ideally) before they ship:
2827

28+
## Use Semantic Structure
29+
30+
Semantic structure is created with `<h1>`-`<h6>` headings, landmarks such as `<main>`, `<nav>`, `<footer>`, `<section>` (with unique labels), content markup including `<ul>` and `<ol>` lists, and more. These are incredibly important for people who rely on AT to understand the structure of a page.
31+
2932
## Keyboard Navigation
3033

3134
By far the easiest and also one of the most important checks is to test if your entire website can be reached and used with the keyboard alone. Do this by:
@@ -35,36 +38,86 @@ By far the easiest and also one of the most important checks is to test if your
3538
3. Using `Enter` to activate elements.
3639
4. Where required, using your keyboard arrow keys to interact with some elements, such as menus and dropdowns.
3740

38-
::: info
41+
::: warning
42+
43+
Users should know which element is currently focused. Do not remove default styles of the focused elements. If you want to change the style of the focus ring, replace the default one with your own outline.
44+
45+
Here are some examples of custom focus rings in [Tapsi design system](https://github.com/Tap30/web-components):
46+
47+
<section aria-hidden="true" style="background: white; border-radius: 8px; padding: 12px; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px;">
48+
49+
<tapsi-button variant="brand">عنوان دکمه</tapsi-button>
50+
<tapsi-rate-slider label="rate-slider"></tapsi-rate-slider>
51+
<tapsi-radio label="radio"></tapsi-radio>
52+
<tapsi-switch label="switch"></tapsi-switch>
53+
<tapsi-checkbox label="checkbox"></tapsi-checkbox>
3954

40-
Note that not everything has to be interactive for screen readers (e.g. headings)!
55+
</section>
4156

4257
:::
4358

44-
## Increase text size to 200%!
59+
## Be aware of nested focuses
4560

46-
Is the content still readable? Does increasing the text size cause content to overlap?
61+
Imagine we want to create a linked button:
4762

48-
## Straw Testing
63+
```html
64+
<a href="#">
65+
<tapsi-button variant="brand">nevigate somewhere</tapsi-button>
66+
</a>
67+
```
4968

50-
Proximity issues can arise when interface elements are designed far apart from one another. This mostly affects people with **low-vision** who rely on zoom software.
69+
<a href="#">
70+
<tapsi-button variant="brand">nevigate somewhere</tapsi-button>
71+
</a>
5172

52-
What happens when someone uses zoom software is that they only see a small fraction of the screen at once. Usually, the zoomed portion of the screen follows the current position of the mouse pointer or keyboard cursor.
73+
As you see both link and button are focusable, but we want the whole thing be focusable once.
5374

54-
As a result of someone only being able to see a small section at a time, oftentimes when attempting to complete a task, content is difficult to find or may be missed entirely.
75+
We have 2 options:
5576

56-
How do we test to ensure there are minimal to no proximity issues with our design? One relatively simple and effective method is to perform what's called, "the straw test."
77+
1. make the button unfocusable.
5778

58-
<iframe height="500" style="width: 100%;" scrolling="no" title="Poor Proximity" src="//codepen.io/svinkle/embed/wXNMZr/?height=265&amp;theme-id=0&amp;default-tab=result" frameborder="no" allowtransparency="true" allowfullscreen="true">
59-
See the Pen <a href="https://codepen.io/svinkle/pen/wXNMZr/">Poor Proximity</a> by Scott Vinkle
60-
(<a href="https://codepen.io/svinkle">@svinkle</a>) on <a href="https://codepen.io">CodePen</a>.
61-
</iframe>
79+
```html
80+
<a href="#">
81+
<tapsi-button tabindex="-1" variant="brand">nevigate somewhere</tapsi-button>
82+
</a>
83+
```
6284

63-
<iframe height="500" style="width: 100%;" scrolling="no" title="Better Proximity" src="//codepen.io/svinkle/embed/LrqNPV/?height=265&amp;theme-id=0&amp;default-tab=result" frameborder="no" allowtransparency="true" allowfullscreen="true">
64-
See the Pen <a href="https://codepen.io/svinkle/pen/LrqNPV/">Better Proximity</a> by Scott Vinkle
65-
(<a href="https://codepen.io/svinkle">@svinkle</a>) on <a href="https://codepen.io">CodePen</a>.
66-
</iframe>
85+
<a href="#">
86+
<tapsi-button tabindex="-1" variant="brand">nevigate somewhere</tapsi-button>
87+
</a>
88+
89+
1. Use only the link and style it like a button
90+
91+
```html
92+
<a href="#" class="button-like-link">nevigate somewhere</a>
93+
<!-- If you are using `@tapsioss/web-components` or `@tapsioss/react-components` package, you can easily pass href to the button componets and use them as links. -->
94+
```
95+
96+
<tapsi-button href="#" variant="brand">nevigate somewhere</tapsi-button>
97+
98+
## Use Skip Links
6799

100+
On most pages, keyboard and screen reader users must navigate a long list of navigation links and other elements before ever arriving at the main content. This can be particularly difficult for users with some forms of motor disabilities. Consider users with no or limited arm movement who navigate a web page by tapping their heads on a switch or that use a stick in their mouth to press keyboard keys. Requiring users to perform any action numerous times before reaching the main content poses an accessibility barrier.
101+
102+
Of course, sighted people who use their mouse do not have any trouble with web pages like this. They can almost immediately scan over the page and identify where the main content is. Skip navigation links are useful to give screen reader and keyboard users the same capability of navigating directly to the main content.
103+
104+
The idea is simple enough: provide a link at the top of the page that, when activated, jumps the user to the beginning of the main content area.
105+
106+
```html
107+
<body>
108+
<a href="#main">Skip to main content</a>
109+
<nav role="navigation">
110+
<ul>
111+
<li><a href="/">Home</a></li>
112+
<li><a href="/about">About</a></li>
113+
<li><a href="/blog">Blog</a></li>
114+
</ul>
115+
</nav>
116+
<main id="main">
117+
<!-- page specific content -->
118+
</main>
119+
</body>
120+
```
68121

69122
## Modals
70123

@@ -85,8 +138,7 @@ Non-modal dialogs don’t have all of the same background requirements. But the
85138
</tapsi-button-group>
86139
</tapsi-modal>
87140

88-
89-
## Don't be a `div` button creator!
141+
## Don't be a `div` button creator
90142

91143
It’s real easy to add a click event to a `div`. Too easy, in fact. And it happens all the time! the problem is, `div`s are not interactive elements so you have to backfill quite a few things to make them accessible. All the while, you could have just used a `<button>` element and been done with it.
92144

@@ -114,7 +166,6 @@ Then we set a `role="button"` attribute. based on [MDN documentation](https://de
114166

115167
> The button role is for clickable elements that trigger a response when activated by the user. Adding role="button" tells the screen reader the element is a button, but provides no button functionality.
116168
117-
118169
```tsx
119170
const MyComponent = () => {
120171
const fn = () => {
@@ -201,7 +252,7 @@ That’s it. No explicit button `role`, no `tabIndex`, no key handler (because b
201252

202253
:::
203254

204-
## Use `prefer-reduce-motion` for your animations!
255+
## Use `prefer-reduce-motion` for your animations
205256

206257
::: danger Warning
207258

@@ -219,6 +270,29 @@ Such animations can trigger discomfort for those with vestibular motion disorder
219270
on <a href="https://codepen.io">CodePen</a>.
220271
</iframe>
221272

273+
## Straw Testing
274+
275+
Proximity issues can arise when interface elements are designed far apart from one another. This mostly affects people with **low-vision** who rely on zoom software.
276+
277+
What happens when someone uses zoom software is that they only see a small fraction of the screen at once. Usually, the zoomed portion of the screen follows the current position of the mouse pointer or keyboard cursor.
278+
279+
As a result of someone only being able to see a small section at a time, oftentimes when attempting to complete a task, content is difficult to find or may be missed entirely.
280+
281+
How do we test to ensure there are minimal to no proximity issues with our design? One relatively simple and effective method is to perform what's called, "the straw test."
282+
283+
<iframe height="500" style="width: 100%;" scrolling="no" title="Poor Proximity" src="//codepen.io/svinkle/embed/wXNMZr/?height=265&amp;theme-id=0&amp;default-tab=result" frameborder="no" allowtransparency="true" allowfullscreen="true">
284+
See the Pen <a href="https://codepen.io/svinkle/pen/wXNMZr/">Poor Proximity</a> by Scott Vinkle
285+
(<a href="https://codepen.io/svinkle">@svinkle</a>) on <a href="https://codepen.io">CodePen</a>.
286+
</iframe>
287+
288+
<iframe height="500" style="width: 100%;" scrolling="no" title="Better Proximity" src="//codepen.io/svinkle/embed/LrqNPV/?height=265&amp;theme-id=0&amp;default-tab=result" frameborder="no" allowtransparency="true" allowfullscreen="true">
289+
See the Pen <a href="https://codepen.io/svinkle/pen/LrqNPV/">Better Proximity</a> by Scott Vinkle
290+
(<a href="https://codepen.io/svinkle">@svinkle</a>) on <a href="https://codepen.io">CodePen</a>.
291+
</iframe>
292+
293+
## Increase text size to 200%
294+
295+
Is the content still readable? Does increasing the text size cause content to overlap?
222296

223297
## Accessible Media
224298

focus-control.md

Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ Ensure that your web application can be fully operated with the keyboard only:
1313

1414
- [WebAIM talks about keyboard accessibility](https://webaim.org/techniques/keyboard/)
1515

16-
## Keyboard focus and focus outline (focus ring)
17-
16+
<!-- ## Keyboard focus and focus outline (focus ring) -->
17+
<!--
1818
Keyboard focus refers to the current element in the DOM that is selected to accept input from the keyboard. We see it everywhere as a focus outline similar to that shown in the following image:
1919
2020
[![Blue keyboard focus outline around a selected link.](https://legacy.reactjs.org/static/dec0e6bcc1f882baf76ebc860d4f04e5/4fcfe/keyboard-focus.png)](https://legacy.reactjs.org/static/dec0e6bcc1f882baf76ebc860d4f04e5/4fcfe/keyboard-focus.png)
@@ -31,13 +31,9 @@ Here are some examples of custom focus rings in [Tapsi design system](https://gi
3131
<tapsi-switch label="switch"></tapsi-switch>
3232
<tapsi-checkbox label="checkbox"></tapsi-checkbox>
3333
34-
</section>
35-
36-
## Mechanisms to skip to desired content
34+
</section> -->
3735

38-
Provide a mechanism to allow users to skip past navigation sections in your application as this assists and speeds up keyboard navigation.
39-
40-
### Skip Links
36+
## Skip Links
4137

4238
On most pages, keyboard and screen reader users must navigate a long list of navigation links and other elements before ever arriving at the main content. This can be particularly difficult for users with some forms of motor disabilities. Consider users with no or limited arm movement who navigate a web page by tapping their heads on a switch or that use a stick in their mouth to press keyboard keys. Requiring users to perform any action numerous times before reaching the main content poses an accessibility barrier.
4339

@@ -61,9 +57,6 @@ The idea is simple enough: provide a link at the top of the page that, when acti
6157
</body>
6258
```
6359

64-
### Landmark Elements
65-
66-
Check [Semantic HTML: Landmark Elements](/semantic-html#landmark-elements)
6760
<!--
6861
## Programmatically managing focus
6962
@@ -132,3 +125,42 @@ A great focus management example is the [react-aria-modal](https://github.com/d
132125
::: warning
133126
While this is a very important accessibility feature, it is also a technique that should be used judiciously. Use it to repair the keyboard focus flow when it is disturbed, not to try and anticipate how users want to use applications.
134127
::: -->
128+
<!--
129+
## Be aware of nested focuses
130+
131+
Imagine we want to create a linked button:
132+
133+
```html
134+
<a href="#">
135+
<tapsi-button variant="brand">nevigate somewhere</tapsi-button>
136+
</a>
137+
```
138+
139+
<a href="#">
140+
<tapsi-button variant="brand">nevigate somewhere</tapsi-button>
141+
</a>
142+
143+
As you see both link and button are focusable, but we want the whole thing be focusable once.
144+
145+
We have 2 options:
146+
147+
1. make the button unfocusable.
148+
149+
```html
150+
<a href="#">
151+
<tapsi-button tabindex="-1" variant="brand">nevigate somewhere</tapsi-button>
152+
</a>
153+
```
154+
155+
<a href="#">
156+
<tapsi-button tabindex="-1" variant="brand">nevigate somewhere</tapsi-button>
157+
</a>
158+
159+
1. Use only the link and style it like a button
160+
161+
```html
162+
<a href="#" class="button-like-link">nevigate somewhere</a>
163+
<!-- If you are using `@tapsioss/web-components` or `@tapsioss/react-components` package, you can easily pass href to the button componets and use them as links. -->
164+
```
165+
166+
<tapsi-button href="#" variant="brand">nevigate somewhere</tapsi-button> -->

index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ layout: home
55
hero:
66
name: "Accessibility"
77
text: "for React Developers"
8-
tagline: 🚧 Work in Progress
8+
tagline: Tapsi Front-end Chapter Knowledge Sharing
99
image:
1010
src: ./assets/a11y.svg
1111
alt: accessibility icon

intro.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ outline: 'deep'
77

88
<svg style="width: 10rem; margin: 2rem auto" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>human</title><path d="M21,9H15V22H13V16H11V22H9V9H3V7H21M12,2A2,2 0 0,1 14,4A2,2 0 0,1 12,6C10.89,6 10,5.1 10,4C10,2.89 10.89,2 12,2Z" fill="var(--vp-c-brand-1)" /></svg>
99

10-
Accessibility is the practice of making your websites usable by as many people as possible. We traditionally think of this as being about people with disabilities, but the practice of making sites accessible also benefits other groups such as those using mobile devices, or those with slow network connections.
10+
<b>Accessibility is the practice of making your websites usable by as many people as possible</b>. We traditionally think of this as being about people with disabilities, but the practice of making sites accessible also benefits other groups such as those using mobile devices, or those with slow network connections.
1111

1212
You might also think of accessibility as treating everyone the same, and giving them equal opportunities, no matter what their ability or circumstances. Just as it is wrong to exclude someone from a physical building because they are in a wheelchair (modern public buildings generally have wheelchair ramps or elevators), it is also not right to exclude someone from a website because they have a visual impairment. We are all different, but we are all human, and therefore have the same human rights.
1313

1414
Accessibility is the right thing to do. Providing accessible sites is part of the law in some countries, which can open up some significant markets that otherwise would not be able to use your services or buy your products.
1515

1616
## What kinds of disability are we looking at?
1717

18-
People with disabilities are just as diverse as people without disabilities, and so are their disabilities. The key lesson here is to think beyond your own computer and how you use the web, and start learning about how others use it — you are not your users. The main types of disability to consider are explained below, along with any special tools they use to access web content (known as assistive technologies, or ATs).
18+
People with disabilities are just as diverse as people without disabilities, and so are their disabilities. <b>The key lesson here is to think beyond your own computer and how you use the web, and start learning about how others use it — you are not your users</b>. The main types of disability to consider are explained below, along with any special tools they use to access web content (known as assistive technologies, or ATs).
1919

2020
::: info Note
2121

@@ -26,7 +26,6 @@ The World Health Organization's [Disability and health](https://www.who.int/en/n
2626

2727
People with visual impairments include people with blindness, low-level vision, and color blindness. Many people with visual impairments use screen magnifiers that are either physical magnifiers or software zoom capabilities. Most browsers and operating systems these days have zoom capabilities. Some users will rely on screen readers, which is software that reads digital text aloud.
2828

29-
3029
### People with hearing impairments
3130

3231
[Deaf and hard-of-hearing (DHH)](https://www.nad.org/resources/american-sign-language/community-and-culture-frequently-asked-questions/) people have various levels of hearing loss ranging from mild to profound. Although some do use AT (see [Assistive Devices for People with Hearing, Voice, Speech, or Language Disorders](https://www.nidcd.nih.gov/health/assistive-devices-people-hearing-voice-speech-or-language-disorders)), they are not widespread.
@@ -60,4 +59,3 @@ A good foundation of accessibility for people with cognitive impairments include
6059
- Dividing processes into logical, essential steps with progress indicators.
6160
- Website authentication as easy as possible without compromising security.
6261
- Making forms easy to complete, such as with clear error messages and simple error recovery.
63-

0 commit comments

Comments
 (0)