You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
content:"WARNING (W0013): Anchor tags that contain a link to a PDF, Word, Excel, or PowerPoint document is present on the page and could be a potential accessibility issue."!important;
content:"WARNING (W0013): Anchor tags that contain a link to a PDF, Word, Excel, or PowerPoint document is present on the page and could be a potential accessibility issue."!important;
Copy file name to clipboardExpand all lines: codes.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -127,3 +127,9 @@ A list of every Checka11y.css error & warning code with details on what the issu
127
127
128
128
-### W0012
129
129
The `<section>` element represents a generic standalone section of a document, which doesn't have a more specific semantic element to represent it. This means `<section>` element should be identified, typically by including a heading (`<h1>`-`<h6>` element) as a child of the `<section>` element. [Read more about this here](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/section)
130
+
131
+
-### W0013
132
+
The highlighted element `<a>` has been detected to have `href=".pdf|.docx|.doc|.xlsx|.xls|.pptx|.pptm|.ppt|.txt"`. Those anchor elements often have accessibility issues and need to be created with accessibility in mind. This can mean sometimes the element will link to non-accessible content since we cannot guarantee the files will be served in an accessible fashion.
133
+
134
+
-### W0014
135
+
The highlighted element `<a>` has been detected to have `href="https://youtube.com|https://youtu.be|https://spotify.com"`. Those anchor elements often have accessibility issues and need to be created with accessibility in mind. This can mean sometimes the element will link to sites non-accessible content because captioning is often missing or not well generated.
Copy file name to clipboardExpand all lines: cypress/integration/links_spec.js
+39Lines changed: 39 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -72,4 +72,43 @@ describe("<a>", () => {
72
72
.should('eq',"WARNING (W0011): Anchor tags should not be used as buttons. Links should redirect to a resource/page, if they don't they probably should be buttons.")
73
73
});
74
74
});
75
+
76
+
it('should have an anchor tag with a link to a PDF, Word, Excel, or PowerPoint document is present on the page.',()=>{
77
+
constfileTypes=[
78
+
".pdf",
79
+
".docx",
80
+
".doc",
81
+
".xlsx",
82
+
".xls",
83
+
".pptx",
84
+
".pptm",
85
+
".ppt",
86
+
".txt"
87
+
];
88
+
89
+
fileTypes.forEach(ext=>{
90
+
cy.get(`a[href*='${ext}']`)
91
+
.each(element=>{
92
+
cy.get(element)
93
+
.after("content")
94
+
.should('eq',"WARNING (W0013): Anchor tags that contain a link to a PDF, Word, Excel, or PowerPoint document is present on the page and could be a potential accessibility issue.")
95
+
});
96
+
});
97
+
});
98
+
99
+
it('should have an anchor tag with link to a content site',()=>{
100
+
constsites=[
101
+
"https://youtu.be",
102
+
"https://youtube.com",
103
+
"https://spotify.com/"
104
+
];
105
+
sites.forEach(site=>{
106
+
cy.get(`a[href*='${site}']`)
107
+
.each(element=>{
108
+
cy.get(element)
109
+
.after("content")
110
+
.should('eq',"WARNING (W0014): Anchor tags that contain a link to content site (Youtube, Spotify etc) is present on the document.")
Copy file name to clipboardExpand all lines: src/warnings/features/_links.scss
+24Lines changed: 24 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -14,4 +14,28 @@ a {
14
14
@includecontentMessage(warning, "W0011", "Anchor tags should not be used as buttons. Links should redirect to a resource/page, if they don't they probably should be buttons.");
15
15
}
16
16
}
17
+
18
+
/* W0013: Anchor tags that contain a link to a PDF, Word, Excel, or PowerPoint document is present on the page and could be a potential accessibility issue. */
19
+
&[href$=".pdf"],
20
+
&[href$=".docx"],
21
+
&[href$=".doc"],
22
+
&[href$=".xlsx"],
23
+
&[href$=".xls"],
24
+
&[href$=".pptx"],
25
+
&[href$=".pptm"],
26
+
&[href$=".ppt"],
27
+
&[href$=".txt"] {
28
+
&::after {
29
+
@includecontentMessage(warning, "W0013", "Anchor tags that contain a link to a PDF, Word, Excel, or PowerPoint document is present on the page and could be a potential accessibility issue.");
30
+
}
31
+
}
32
+
33
+
/* W0014: Anchor tags that contain a link to content site (Youtube, Spotify etc) is present on the document. */
34
+
&[href*="https://youtu.be"],
35
+
&[href*="https://youtube.com"],
36
+
&[href*="https://spotify.com/"] {
37
+
&::after {
38
+
@includecontentMessage(warning, "W0014", "Anchor tags that contain a link to content site (Youtube, Spotify etc) is present on the document.");
0 commit comments