Skip to content

Commit f72c847

Browse files
dutiyeshSaraVieira
authored andcommitted
Lighthouse improve homepage accessibility (codesandbox#2034)
* Provide discernible name to links * Add label to dependency search input field * Add alt attribute to images * Remove duplicate ids * Minify Embed svg icon * Remove duplicate ids from Code deployment Cube animation
1 parent 61b7908 commit f72c847

File tree

8 files changed

+32
-72
lines changed

8 files changed

+32
-72
lines changed

packages/homepage/src/components/Companies.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ export default ({ companies }) => (
2020
<Grid>
2121
{shuffleArray(companies).map(({ node: company }) => (
2222
<div>
23-
<a href={company.link} target="_blank" rel="noopener noreferrer">
23+
<a
24+
href={company.link}
25+
target="_blank"
26+
rel="noopener noreferrer"
27+
aria-label={`${company.name} is using CodeSandbox`}
28+
>
2429
<img height="150" src={company.logoURL} alt={company.name} />
2530
</a>
2631
</div>

packages/homepage/src/screens/home/CycleFeature/Cube.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,37 +55,37 @@ export default class GlowCube extends React.Component<Props> {
5555
style={{ boxShadow: `0px 0px 100px ${color.clearer(0.3)()}` }}
5656
rotate="rotateX(90deg)"
5757
size={size}
58-
id={`${id}-side`}
58+
className={`${id}-side`}
5959
/>
6060
<Side
6161
style={{ boxShadow: `0px 0px 150px ${color.clearer(0.3)()}` }}
6262
rotate="rotateX(-90deg)"
6363
size={size}
64-
id={`${id}-side`}
64+
className={`${id}-side`}
6565
/>
6666
<Side
6767
style={{ boxShadow: `0px 0px 150px ${color.clearer(0.3)()}` }}
6868
rotate="rotateY(0deg)"
6969
size={size}
70-
id={`${id}-side`}
70+
className={`${id}-side`}
7171
/>
7272
<Side
7373
style={{ boxShadow: `0px 0px 150px ${color.clearer(0.3)()}` }}
7474
rotate="rotateY(-180deg)"
7575
size={size}
76-
id={`${id}-side`}
76+
className={`${id}-side`}
7777
/>
7878
<Side
7979
style={{ boxShadow: `0px 0px 150px ${color.clearer(0.3)()}` }}
8080
rotate="rotateY(-90deg)"
8181
size={size}
82-
id={`${id}-side`}
82+
className={`${id}-side`}
8383
/>
8484
<Side
8585
style={{ boxShadow: `0px 0px 150px ${color.clearer(0.3)()}` }}
8686
rotate="rotateY(90deg)"
8787
size={size}
88-
id={`${id}-side`}
88+
className={`${id}-side`}
8989
/>
9090
</Sides>
9191
</Cube>

packages/homepage/src/screens/home/CycleFeature/index.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ export default class CycleFeatures extends React.PureComponent {
207207
transformOrigin: '50% 50%',
208208
position: 'absolute',
209209
})
210-
.set('#main-cube-side', {
210+
.set('.main-cube-side', {
211211
backgroundColor: Theme.secondary.clearer(0.2)(),
212212
zIndex: 1,
213213
boxShadow: `0px 0px 150px ${Theme.secondary()}`,
@@ -253,7 +253,7 @@ export default class CycleFeatures extends React.PureComponent {
253253
},
254254
'step1'
255255
)
256-
.set('#main-cube-side', { backgroundColor: Theme.primary.clearer(0.2)() })
256+
.set('.main-cube-side', { backgroundColor: Theme.primary.clearer(0.2)() })
257257
.to('#addition-cube', 0.6, {
258258
ease: Power2.easeOut,
259259
y: -45,
@@ -268,7 +268,7 @@ export default class CycleFeatures extends React.PureComponent {
268268
'-=0.6'
269269
)
270270
.to(
271-
'#main-cube-side',
271+
'.main-cube-side',
272272
0.2,
273273
{
274274
boxShadow: `0px 0px 150px ${Theme.primary()}`,
@@ -311,7 +311,7 @@ export default class CycleFeatures extends React.PureComponent {
311311
},
312312
'-=0.2'
313313
)
314-
.to('#main-cube-side', 0.7, {
314+
.to('.main-cube-side', 0.7, {
315315
backgroundColor: Theme.secondary.clearer(0.2)(),
316316
boxShadow: `0px 0px 150px ${Theme.secondary()}`,
317317
ease: Power2.easeInOut,
@@ -441,19 +441,15 @@ export default class CycleFeatures extends React.PureComponent {
441441
rel="noopener noreferrer"
442442
>
443443
<span>github.com/</span>
444-
<AddedUrl id="added-url">
445-
reduxjs/redux/tree/master/examples/todos
446-
</AddedUrl>
444+
<AddedUrl>reduxjs/redux/tree/master/examples/todos</AddedUrl>
447445
</AddressBar>
448446
<AddressBar
449447
href="/s/github/reduxjs/redux/tree/master/examples/todos"
450448
target="_blank"
451449
rel="noopener noreferrer"
452450
>
453451
<span>codesandbox.io/s/github/</span>
454-
<AddedUrl id="added-url">
455-
reduxjs/redux/tree/master/examples/todos
456-
</AddedUrl>
452+
<AddedUrl>reduxjs/redux/tree/master/examples/todos</AddedUrl>
457453
</AddressBar>
458454
</ImportContainer>
459455

@@ -463,6 +459,7 @@ export default class CycleFeatures extends React.PureComponent {
463459
href="https://csb-921ywn9qrw-emlplxhibt.now.sh/"
464460
target="_blank"
465461
rel="noopener noreferrer"
462+
aria-label="Open deployed sandbox"
466463
>
467464
<span id="progress-text" style={{ textAlign: 'center' }}>
468465
Deploying...

packages/homepage/src/screens/home/ExtraFeatures/VSCode.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,8 @@ import React from 'react';
44
export default () => (
55
<IconBase viewBox="0 0 435 445">
66
<g>
7-
<path
8-
d="M82.255,191.38 L22.546,130.798 L46.776,120.414 L105.62,168.008 L208.597,66.762 L268.306,95.319 L268.306,287.428 L208.597,315.119 L106.485,216.469 L45.045,262.333 L22.546,250.218 L82.255,191.38 Z M207.731,241.563 L207.731,140.317 L145.426,190.94 L207.731,241.563 Z"
9-
id="Shape"
10-
/>
11-
<polygon
12-
id="Shape"
13-
points="0.046 331.56 322.823 380.885 322.823 0.995 434.454 52.051 434.454 398.193 324.554 444.922"
14-
/>
7+
<path d="M82.255,191.38 L22.546,130.798 L46.776,120.414 L105.62,168.008 L208.597,66.762 L268.306,95.319 L268.306,287.428 L208.597,315.119 L106.485,216.469 L45.045,262.333 L22.546,250.218 L82.255,191.38 Z M207.731,241.563 L207.731,140.317 L145.426,190.94 L207.731,241.563 Z" />
8+
<polygon points="0.046 331.56 322.823 380.885 322.823 0.995 434.454 52.051 434.454 398.193 324.554 444.922" />
159
</g>
1610
</IconBase>
1711
);

packages/homepage/src/screens/home/NPMFeature/EmbedAnimation/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,24 +81,28 @@ export default class EmbedAnimation extends React.PureComponent {
8181
this.vue = el;
8282
}}
8383
src={vueSvg}
84+
alt="VueJS"
8485
/>
8586
<AbsoluteImage
8687
ref={el => {
8788
this.egghead = el;
8889
}}
8990
src={eggheadSvg}
91+
alt="Egghead.io"
9092
/>
9193
<AbsoluteImage
9294
ref={el => {
9395
this.medium = el;
9496
}}
9597
src={mediumSvg}
98+
alt="Medium"
9699
/>
97100
<AbsoluteImage
98101
ref={el => {
99102
this.codesandbox = el;
100103
}}
101104
src={codesandboxSvg}
105+
alt="CodeSandbox Editor"
102106
/>
103107
</Relative>
104108
);

packages/homepage/src/screens/home/NPMFeature/EmbedIcon.js

Lines changed: 5 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -4,53 +4,11 @@ import IconBase from 'react-icons/lib/IconBase';
44

55
export default () => (
66
<IconBase x="0px" y="0px" viewBox="0 0 379 233">
7-
<g id="Page-1" stroke="none" strokeWidth={1} fill="none" fillRule="evenodd">
8-
<g id="Artboard" fillRule="nonzero" fill="#d3f2ff">
9-
<g id="Embed">
10-
<g id="Layer_2">
11-
<polygon
12-
id="Shape"
13-
points="24.849 114.232 19.883 117.176 24.849 120.002 64.866 141.554 64.866 173.469 0.24 130.248 0.24 103.75 64.866 60.529 64.866 92.326"
14-
/>
15-
<polygon
16-
id="Shape"
17-
points="318.688 93.197 318.688 63.809 378.417 103.755 378.417 128.245 318.688 168.191 318.688 138.694 355.673 118.776 360.262 116.164 355.673 113.443"
18-
/>
19-
<g id="Group" transform="translate(90.000000, 0.000000)">
20-
<polyline
21-
id="Shape"
22-
points="152.722 197.322 152.722 147.107 196.242 121.888 196.242 172.177 152.722 197.322"
23-
/>
24-
<polyline
25-
id="Shape"
26-
points="53.573 147.961 10.786 123.156 10.786 172.766 53.573 197.696 53.573 147.961"
27-
/>
28-
<polyline
29-
id="Shape"
30-
points="103.49 60.53 147 35.283 103.509 9.925 59.84 35.368 103.49 60.53"
31-
/>
32-
<g>
33-
<polygon
34-
id="Shape"
35-
points="108 225 94 225 94 112.479 190.246 56.7 197.429 70.087 108 121.403"
36-
/>
37-
<rect
38-
id="Rectangle-path"
39-
transform="translate(57.093009, 90.321336) rotate(29.913306) translate(-57.093009, -90.321336) "
40-
x="3.68183546"
41-
y="82.5921657"
42-
width="106.822346"
43-
height="15.4583395"
44-
/>
45-
<path
46-
d="M100.486,232.884 L0,175.181 L0,59.226 L100.491,0.749 L201,58.979 L201,174.996 L100.486,232.884 Z M16,166.233 L100.975,215.051 L186,166.061 L186,67.887 L101.009,18.625 L16,68.115 L16,166.233 Z"
47-
id="Shape"
48-
/>
49-
</g>
50-
</g>
51-
</g>
52-
</g>
53-
</g>
7+
<g fillRule="nonzero" fill="#d3f2ff">
8+
<path d="M24.849 114.232l-4.966 2.944 4.966 2.826 40.017 21.552v31.915L.24 130.248V103.75l64.626-43.221v31.797zM318.688 93.197V63.809l59.729 39.946v24.49l-59.729 39.946v-29.497l36.985-19.918 4.589-2.612-4.589-2.721zM242.722 197.322v-50.215l43.52-25.219v50.289l-43.52 25.145M143.573 147.961l-42.787-24.805v49.61l42.787 24.93v-49.735M193.49 60.53L237 35.283 193.509 9.925 149.84 35.368l43.65 25.162" />
9+
<path d="M198 225h-14V112.479L280.246 56.7l7.183 13.387L198 121.403z" />
10+
<path d="M104.652 56.986l92.591 53.271-7.709 13.399-92.59-53.271z" />
11+
<path d="M190.486 232.884L90 175.181V59.226L190.491.749 291 58.979v116.017l-100.514 57.888zM106 166.233l84.975 48.818L276 166.061V67.887l-84.991-49.262L106 68.115v98.118z" />
5412
</g>
5513
</IconBase>
5614
);

packages/homepage/src/screens/home/NPMFeature/SearchInput/Input.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ const SearchInput = ({ searchQuery }) => {
4747
onChange={onChange}
4848
placeholder="Search for a dependency"
4949
value={query}
50+
aria-label="Search for a dependency"
5051
/>
5152

5253
<Icon />

packages/homepage/src/screens/home/Users/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export default () => (
5151
logoURL
5252
link
5353
pinned
54+
name
5455
}
5556
}
5657
}

0 commit comments

Comments
 (0)