Skip to content

Commit 5c80a94

Browse files
Merge pull request #31 from eBay/v11-touch-targets
feat: align touch target checks to latest WCAG guidance
2 parents 3a1cfe0 + b2a83cd commit 5c80a94

File tree

18 files changed

+413
-315
lines changed

18 files changed

+413
-315
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ The plugin was developed by members of the accessibility and design teams at eBa
3535

3636
**Future explorations**
3737

38-
- [ ] Touch target revision (we are waiting for the WCAG updates to make the step aligned with the latest recommendations)
38+
- [X] Touch target revision
3939
- [ ] Pointer gestures
4040
- [ ] Split between focus & reading order
4141
- [ ] Interactive elements step

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

previews/v11/include_banner.png

3.29 KB
Loading

src/components/Footer.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ function Footer({ primaryAction, secondaryAction, routeName }) {
7070
updateState('gestures', {});
7171
updateState('gesturesTemp', null);
7272

73+
updateState('touchTargets', {});
74+
7375
// make all layers visible
7476
sendToFigma('show-all-layers');
7577
};

src/constants/utilities.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,13 +278,13 @@ const getBase64FromHash = async (imagesScanned) => {
278278
};
279279

280280
export default {
281-
isEnterKey,
282281
capitalize,
283282
checkIfChildNameExists,
284283
checkTypeOfA11yLayer,
285284
frameExistsOrCreate,
286285
getBase64FromHash,
287286
hasNoImageFills,
287+
isEnterKey,
288288
nameBeforePipe,
289289
sanitizeName,
290290
showAllLayers,

src/context/AppState.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,10 @@ class AppState extends React.Component {
211211
const newPages = [...pages];
212212
const newStepsData = { ...stepsData };
213213

214-
if (status === 'add') {
215-
const indexFound = pages.findIndex((p) => p.id === main.id);
216-
const newPage = newPages[indexFound];
214+
const indexFound = pages.findIndex((p) => p.id === main.id);
215+
const newPage = newPages[indexFound];
217216

217+
if (status === 'add') {
218218
// make sure it's not already present
219219
if (newPage.stepsCompleted.includes(stepKey) === false) {
220220
newPage.stepsCompleted.push(stepKey);
@@ -224,6 +224,12 @@ class AppState extends React.Component {
224224
visible: true
225225
};
226226
}
227+
228+
newPage.stepsData[stepKey] = {
229+
...(newPage.stepsData[stepKey] || {}),
230+
...data[stepKey],
231+
visible: true
232+
};
227233
}
228234

229235
// check if we have previous steps data
@@ -287,9 +293,7 @@ class AppState extends React.Component {
287293

288294
const newTargetEntry = {
289295
id: targetId,
290-
label: data.label,
291-
name: data.name,
292-
type: data.touchTargetType
296+
name: data.name
293297
};
294298

295299
this.setState({
@@ -382,6 +386,7 @@ class AppState extends React.Component {
382386

383387
return (
384388
<Context.Provider
389+
// eslint-disable-next-line react/jsx-no-constructed-context-values
385390
value={{
386391
// global ui
387392
alertMsg,

src/data/tips.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
"text": "Alternative text is announced by screen readers and describes the purpose, function, or content of an image.<br/><br/>Images that convey meaning are <em>informative</em> and require alt text. Images that do not convey meaning, or are non-functional and beside text that conveys their meaning are considered <em>decorative.</em>"
1414
},
1515
"Contrast": {
16-
"text": "Text must have a contrast ratio of 4.5:1. Large text must have a contrast ratio of 3:1. Interactive and meaningful graphical elements must have a contrast ratio of 3:1.<br />Large text is 24px or greater, or 19px bold or greater. In CSS, bold text typically has font-weight:bold, or font-weight:700 or greater."
16+
"text": "Text must have a contrast ratio of 4.5:1. Large text must have a contrast ratio of 3:1. Interactive and meaningful graphical elements must have a contrast ratio of 3:1."
1717
},
1818
"Touch target": {
19-
"text": "Click or touch areas should be a minimum of 24px x 24px but many teams adhere to the standard native sizes: 44px x 44px for iOS and 48px x 48px for Android."
19+
"text": "WCAG SC 2.5.8 Target Size defines the minimum area as 24px by 24px. Some teams prefer to use 44px x 44px for iOS and 48px x 48px for Android.<br/><br/>There are exceptions for undersize targets with sufficient spacing, links within sentences or blocks of text, or targets like pins on a map, or dots on a chart.<br/><br/>Use this step of <span style=\"font-style: italic;\">Include</span> as a tool to check where needed; it may not be necessary to annotate every target in every design."
2020
},
2121
"Text zoom": {
2222
"text": "Mobile devices allow users to customize text sizes. Ensure the layout will adapt to respect these user preferences."
@@ -42,10 +42,10 @@
4242
"text": "Alternative text is announced by screen readers and describes the purpose, function, or content of an image.<br/><br/>Images that convey meaning are <em>informative</em> and require alt text. Images that do not convey meaning, or are non-functional and beside text that conveys their meaning are considered <em>decorative.</em>"
4343
},
4444
"Contrast": {
45-
"text": "Text must have a contrast ratio of 4.5:1. Large text must have a contrast ratio of 3:1. Interactive and meaningful graphical elements must have a contrast ratio of 3:1.<br />Large text is 24px or greater, or 19px bold or greater. In CSS, bold text typically has font-weight:bold, or font-weight:700 or greater."
45+
"text": "Text must have a contrast ratio of 4.5:1. Large text must have a contrast ratio of 3:1. Interactive and meaningful graphical elements must have a contrast ratio of 3:1.<br /><br />Large text is 24px or greater, or 19px bold or greater. In CSS, bold text typically has font-weight:bold, or font-weight:700 or greater."
4646
},
4747
"Touch target": {
48-
"text": "Click or touch areas should be a minimum of 24px x 24px but many teams adhere to the standard native sizes: 44px x 44px for iOS and 48px x 48px for Android."
48+
"text": "WCAG SC 2.5.8 Target Size defines the minimum area as 24px by 24px, but allows exceptions for undersize targets with sufficient spacing, links within sentences or blocks of text, or targets like pins on a map, or dots on a chart.<br/><br/>Use this step of <span style=\"font-style: italic;\">Include</span> as a tool to check where needed; it may not be necessary to annotate every target in every design."
4949
},
5050
"Text zoom": {
5151
"text": "Users must be able to resize text at least 200% without loss of information. Enlarge the text in your design and consider how the content and layout is impacted.<br /><br />This step aligns with WCAG SC 1.4.4 Resize text"
@@ -60,4 +60,4 @@
6060
"text": "People may perceive colors differently, and may not be able to differentiate between some or all colors. Ensure a design does not rely only on color to convey meaning."
6161
}
6262
}
63-
}
63+
}

src/figma-code/config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ export default {
2222
],
2323
a11yCheckboxLayers: [
2424
'Contrast Layer',
25-
// 'Touch target Layer',
2625
'Text zoom Layer',
2726
'Responsive reflow Layer',
2827
'Color blindness Layer'

src/figma-code/steps/checkmark.js

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { figmaLayer, utils } from '../../constants';
33
import { getOrCreateMainA11yFrame } from '../frame-helpers';
44

55
export const add = (msg) => {
6-
const { create, layerName, page, pageType } = msg;
6+
const { create, layerName, page, pageType, existingData, stateKey } = msg;
77

88
// main data and setup
99
const { bounds, mainPageId, name } = page;
@@ -31,23 +31,27 @@ export const add = (msg) => {
3131
// if (mainFrame.children.length === 0) {
3232
// mainFrame.remove();
3333
// }
34-
} else if (layerExists === null && create === true) {
35-
// create the layer frame
36-
const layerFrame = figmaLayer.createTransparentFrame({
37-
name: layerName,
38-
height: 10,
39-
width: 10
40-
});
41-
42-
// update with id (for future scanning)
43-
layerFrame.name = `${layerName} | ${layerFrame.id}`;
44-
layerFrame.expanded = false;
45-
layerFrame.visible = false;
46-
47-
layerId = layerFrame.id;
48-
49-
// add within main Accessibility layer
50-
mainFrame.appendChild(layerFrame);
34+
} else if (create) {
35+
if (layerExists === null) {
36+
// create the layer frame
37+
const layerFrame = figmaLayer.createTransparentFrame({
38+
name: layerName,
39+
height: 10,
40+
width: 10
41+
});
42+
43+
// update with id (for future scanning)
44+
layerFrame.name = `${layerName} | ${layerFrame.id}`;
45+
layerFrame.expanded = false;
46+
layerFrame.visible = false;
47+
48+
layerId = layerFrame.id;
49+
50+
// add within main Accessibility layer
51+
mainFrame.appendChild(layerFrame);
52+
} else {
53+
layerId = layerExists;
54+
}
5155
}
5256

5357
// grab main page a11y scan was for
@@ -59,14 +63,18 @@ export const add = (msg) => {
5963
// update pagesData
6064
const stepKey = layerName.replace(/ Layer/g, '');
6165

66+
const updateData = { id: layerId };
67+
if (existingData) {
68+
updateData.existingData = existingData;
69+
}
70+
6271
figma.ui.postMessage({
6372
type: 'update-pages-data',
6473
data: {
6574
status,
6675
stepKey,
67-
[stepKey]: {
68-
id: layerId
69-
},
76+
stateKey,
77+
[stepKey]: updateData,
7078
main: {
7179
id: mainFrame.id,
7280
name: saniName,

src/figma-code/steps/headings.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ export const noHeadings = (msg) => {
6969
status: 'add',
7070
stepKey: 'Headings',
7171
Headings: {
72-
id: headingsFrame.id
72+
id: headingsFrame.id,
73+
existingData: {}
7374
},
7475
main: {
7576
id: mainFrame.id,
@@ -354,7 +355,8 @@ export const confirm = (msg) => {
354355
status: 'add',
355356
stepKey: 'Headings',
356357
Headings: {
357-
id: headingsFrame.id
358+
id: headingsFrame.id,
359+
existingData: headings
358360
},
359361
main: {
360362
id: mainFrame.id,

0 commit comments

Comments
 (0)