Skip to content

Commit 18e5313

Browse files
zackseuberlingdanilowoz
authored andcommitted
fix(svg): uses correct aria-* attribute for label (#149)
according to the MDN documentation, the aria-labelledby attribute is reserved for one or more element IDs to associate a label with an element. the aria-label attribute is for a string when no visible label on the screen
1 parent 8f28d2e commit 18e5313

File tree

7 files changed

+8
-8
lines changed

7 files changed

+8
-8
lines changed

src/Svg.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export default ({
3535
role="img"
3636
style={{ ...style, ...rtlStyle }}
3737
className={className}
38-
aria-labelledby={ariaLabel ? ariaLabel : null}
38+
aria-label={ariaLabel ? ariaLabel : null}
3939
viewBox={`0 0 ${width} ${height}`}
4040
preserveAspectRatio={preserveAspectRatio}
4141
{...props}

src/__tests__/Svg.tests.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ describe('Svg', () => {
126126
it('svg has aria-label', () => {
127127
const { svg } = partsOfComponent
128128

129-
expect(typeof svg.props['aria-labelledby']).toBe('string')
130-
expect(svg.props['aria-labelledby'].length).not.toBe(0)
129+
expect(typeof svg.props['aria-label']).toBe('string')
130+
expect(svg.props['aria-label'].length).not.toBe(0)
131131
})
132132

133133
it('svg has role', () => {

src/__tests__/stylized/__snapshots__/BulletListStyle.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
exports[`BulletListStyle renders correctly 1`] = `
44
<svg
5-
aria-labelledby="Loading interface..."
5+
aria-label="Loading interface..."
66
preserveAspectRatio="none"
77
role="img"
88
style={Object {}}

src/__tests__/stylized/__snapshots__/CodeStyle.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
exports[`CodeStyle renders correctly 1`] = `
44
<svg
5-
aria-labelledby="Loading interface..."
5+
aria-label="Loading interface..."
66
preserveAspectRatio="none"
77
role="img"
88
style={Object {}}

src/__tests__/stylized/__snapshots__/FacebookStyle.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
exports[`FacebookStyle renders correctly 1`] = `
44
<svg
5-
aria-labelledby="Loading interface..."
5+
aria-label="Loading interface..."
66
preserveAspectRatio="none"
77
role="img"
88
style={Object {}}

src/__tests__/stylized/__snapshots__/InstagramStyle.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
exports[`InstagramStyle renders correctly 1`] = `
44
<svg
5-
aria-labelledby="Loading interface..."
5+
aria-label="Loading interface..."
66
preserveAspectRatio="none"
77
role="img"
88
style={Object {}}

src/__tests__/stylized/__snapshots__/ListStyle.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
exports[`ListStyle renders correctly 1`] = `
44
<svg
5-
aria-labelledby="Loading interface..."
5+
aria-label="Loading interface..."
66
preserveAspectRatio="none"
77
role="img"
88
style={Object {}}

0 commit comments

Comments
 (0)