Skip to content

Commit 31a1b18

Browse files
authored
Merge pull request #72 from dlabaj/a11y
Fixed a11y component issues.
2 parents 8b77723 + cb3b078 commit 31a1b18

4 files changed

Lines changed: 34 additions & 20 deletions

File tree

packages/module/src/Ansible/Ansible.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const Ansible: React.FunctionComponent<AnsibleProps> = ({ unsupported, className
7171
);
7272

7373
return (
74-
<i className={ansibleLogoClass} {...props}>
74+
<i className={ansibleLogoClass} title={unsupported ? "Ansible is not supported" : "Ansible supported" }{...props}>
7575
<svg
7676
version="1.1"
7777
x="0px"

packages/module/src/Ansible/__snapshots__/Ansible.test.tsx.snap

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ exports[`Ansible component should render supported - boolean 1`] = `
44
<div>
55
<i
66
class="ansible-0-2-1 ansibleSupported-0-2-2"
7+
title="Ansible supported"
78
>
89
<svg
910
style="enable-background: new 0 0 2032 2027.2;"
@@ -28,6 +29,7 @@ exports[`Ansible component should render supported - number 1`] = `
2829
<div>
2930
<i
3031
class="ansible-0-2-1 ansibleSupported-0-2-2"
32+
title="Ansible supported"
3133
>
3234
<svg
3335
style="enable-background: new 0 0 2032 2027.2;"
@@ -52,6 +54,7 @@ exports[`Ansible component should render unsupported - boolean 1`] = `
5254
<div>
5355
<i
5456
class="ansible-0-2-1 ansibleUnsupported-0-2-3"
57+
title="Ansible is not supported"
5558
>
5659
<svg
5760
style="enable-background: new 0 0 2032 2027.2;"
@@ -100,6 +103,7 @@ exports[`Ansible component should render unsupported - number 1`] = `
100103
<div>
101104
<i
102105
class="ansible-0-2-1 ansibleUnsupported-0-2-3"
106+
title="Ansible is not supported"
103107
>
104108
<svg
105109
style="enable-background: new 0 0 2032 2027.2;"

packages/module/src/Battery/Battery.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,17 +91,15 @@ const Battery: React.FunctionComponent<BatteryProps> = ({ severity, label, label
9191
const classes = useStyles();
9292
const batteryClasses = clsx(classes.battery, classes[String(batteryLevels(severity, true))], className);
9393

94-
let ariaLabels = {};
95-
if (labelHidden) {
96-
ariaLabels = { ['aria-label']: `${severity} ${label}` };
97-
}
94+
const title = { ['title']: `${severity} ${label}` };
95+
9896

9997
const batteryVariant = useMemo(() => batteryLevels(severity) , [ severity ])
10098

10199
return (
102100
<React.Fragment>
103101
{/* eslint-disable-next-line react/no-unknown-property */}
104-
<i className={batteryClasses} {...ariaLabels} {...props} widget-type="InsightsBattery" widget-id={label}>
102+
<i className={batteryClasses} {...title} {...props} widget-type="Battery" widget-id={label}>
105103
<svg
106104
version="1.1"
107105
x="0px"

packages/module/src/Battery/__snapshots__/Batery.test.tsx.snap

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
exports[`Battery component API should hide label 1`] = `
44
<div>
55
<i
6-
aria-label="high high"
76
class="battery-0-2-1 batteryHigh-0-2-5"
7+
title="high high"
88
widget-id="high"
9-
widget-type="InsightsBattery"
9+
widget-type="Battery"
1010
>
1111
<svg
1212
shape-rendering="geometricpresision"
@@ -32,8 +32,9 @@ exports[`Battery component should render correctly CriticalBattery - 4 1`] = `
3232
<div>
3333
<i
3434
class="battery-0-2-1 batteryCritical-0-2-6"
35+
title="4 4"
3536
widget-id="4"
36-
widget-type="InsightsBattery"
37+
widget-type="Battery"
3738
>
3839
<svg
3940
shape-rendering="geometricpresision"
@@ -64,8 +65,9 @@ exports[`Battery component should render correctly CriticalBattery - critical 1`
6465
<div>
6566
<i
6667
class="battery-0-2-1 batteryCritical-0-2-6"
68+
title="critical critical"
6769
widget-id="critical"
68-
widget-type="InsightsBattery"
70+
widget-type="Battery"
6971
>
7072
<svg
7173
shape-rendering="geometricpresision"
@@ -96,8 +98,9 @@ exports[`Battery component should render correctly HighBattery - 3 1`] = `
9698
<div>
9799
<i
98100
class="battery-0-2-1 batteryHigh-0-2-5"
101+
title="3 3"
99102
widget-id="3"
100-
widget-type="InsightsBattery"
103+
widget-type="Battery"
101104
>
102105
<svg
103106
shape-rendering="geometricpresision"
@@ -128,8 +131,9 @@ exports[`Battery component should render correctly HighBattery - error 1`] = `
128131
<div>
129132
<i
130133
class="battery-0-2-1 batteryHigh-0-2-5"
134+
title="error error"
131135
widget-id="error"
132-
widget-type="InsightsBattery"
136+
widget-type="Battery"
133137
>
134138
<svg
135139
shape-rendering="geometricpresision"
@@ -160,8 +164,9 @@ exports[`Battery component should render correctly HighBattery - high 1`] = `
160164
<div>
161165
<i
162166
class="battery-0-2-1 batteryHigh-0-2-5"
167+
title="high high"
163168
widget-id="high"
164-
widget-type="InsightsBattery"
169+
widget-type="Battery"
165170
>
166171
<svg
167172
shape-rendering="geometricpresision"
@@ -192,8 +197,9 @@ exports[`Battery component should render correctly LowBattery - 1 1`] = `
192197
<div>
193198
<i
194199
class="battery-0-2-1 batteryLow-0-2-3"
200+
title="1 1"
195201
widget-id="1"
196-
widget-type="InsightsBattery"
202+
widget-type="Battery"
197203
>
198204
<svg
199205
shape-rendering="geometricpresision"
@@ -224,8 +230,9 @@ exports[`Battery component should render correctly LowBattery - info 1`] = `
224230
<div>
225231
<i
226232
class="battery-0-2-1 batteryLow-0-2-3"
233+
title="info info"
227234
widget-id="info"
228-
widget-type="InsightsBattery"
235+
widget-type="Battery"
229236
>
230237
<svg
231238
shape-rendering="geometricpresision"
@@ -256,8 +263,9 @@ exports[`Battery component should render correctly LowBattery - low 1`] = `
256263
<div>
257264
<i
258265
class="battery-0-2-1 batteryLow-0-2-3"
266+
title="low low"
259267
widget-id="low"
260-
widget-type="InsightsBattery"
268+
widget-type="Battery"
261269
>
262270
<svg
263271
shape-rendering="geometricpresision"
@@ -288,8 +296,9 @@ exports[`Battery component should render correctly MediumBattery - 2 1`] = `
288296
<div>
289297
<i
290298
class="battery-0-2-1 batteryMedium-0-2-4"
299+
title="2 2"
291300
widget-id="2"
292-
widget-type="InsightsBattery"
301+
widget-type="Battery"
293302
>
294303
<svg
295304
shape-rendering="geometricpresision"
@@ -320,8 +329,9 @@ exports[`Battery component should render correctly MediumBattery - medium 1`] =
320329
<div>
321330
<i
322331
class="battery-0-2-1 batteryMedium-0-2-4"
332+
title="medium medium"
323333
widget-id="medium"
324-
widget-type="InsightsBattery"
334+
widget-type="Battery"
325335
>
326336
<svg
327337
shape-rendering="geometricpresision"
@@ -352,8 +362,9 @@ exports[`Battery component should render correctly MediumBattery - warn 1`] = `
352362
<div>
353363
<i
354364
class="battery-0-2-1 batteryMedium-0-2-4"
365+
title="warn warn"
355366
widget-id="warn"
356-
widget-type="InsightsBattery"
367+
widget-type="Battery"
357368
>
358369
<svg
359370
shape-rendering="geometricpresision"
@@ -384,8 +395,9 @@ exports[`Battery component should render correctly NullBatery, default 1`] = `
384395
<div>
385396
<i
386397
class="battery-0-2-1 batteryDefault-0-2-2"
398+
title=" "
387399
widget-id=""
388-
widget-type="InsightsBattery"
400+
widget-type="Battery"
389401
>
390402
<svg
391403
shape-rendering="geometricpresision"

0 commit comments

Comments
 (0)