-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add rules for 1.1 Text Alternatives (#19)
* fix: broken selector * refactor: prefer for..of over forEach * refactor: prefer template literals over string concatenation * fix: post-refactor logic and compatibility issues * feat: set up initial check for missing alt text * feat: add more checks for detectable alt text issues * fix: prevent buggy behavior from content scripts auto-loading * chore: bump version number
- Loading branch information
1 parent
f48eebd
commit b3d6f1b
Showing
7 changed files
with
106 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
:root { | ||
--error-color: hotpink; | ||
--inverted-error-color: #00964b; | ||
--warning-color: goldenrod; | ||
--info-color: cornflowerblue; | ||
--error-outline: 0.25rem solid var(--error-color); | ||
--inverted-error-outline: 0.25rem solid var(--inverted-error-color); | ||
--warning-outline: 0.25rem solid var(--warning-color); | ||
--info-outline: 0.25rem solid var(--info-color); | ||
} | ||
|
||
img:not([alt]) { | ||
--wcag-success-criteria: '1.1.1 Non-Text Content'; | ||
--error-missing-alt-text: 'This image does not have alt text. Even if it is purely decorative, the alt attribute must exist.'; | ||
|
||
background-color: var(--inverted-error-color); | ||
outline: var(--inverted-error-outline); | ||
outline-offset: 0.25rem; | ||
filter: invert(100%); | ||
} | ||
|
||
img[alt=''] { | ||
--wcag-success-criteria: '1.1.1 Non-Text Content'; | ||
--warning-decorative-image: 'This image will be treated as purely decorative. Are you sure it does not convey any useful information or context?'; | ||
|
||
filter: opacity(5%) blur(5px); | ||
} | ||
|
||
img[alt^="image" i], | ||
img[alt^="picture" i], | ||
img[alt^="graphic" i] { | ||
--wcag-success-criteria: '1.1.1 Non-Text Content'; | ||
--info-repetitive-alt-text: 'Screen readers will let users know they are describing an image, so it is redundant to start alt text with immage, picture, or graphic.'; | ||
|
||
outline: var(--info-outline); | ||
outline-offset: 0.25rem; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// TODO: add scripts to check for errors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters