diff --git a/accessibility_tests.sh b/accessibility_tests.sh new file mode 100755 index 00000000..0161e6d5 --- /dev/null +++ b/accessibility_tests.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +ignores="WCAG2AA.Principle1.Guideline1_4.1_4_3.G18.Fail" +base_url="http://192.168.50.60:1234" + +test_urls=( + $base_url + $base_url/communities + $base_url/login + $base_url/search + $base_url/c/announcements + $base_url/u/dessalines + $base_url/post/34286 +) + +for i in "${test_urls[@]}"; do + pa11y --ignore="$ignores" "$i" +done diff --git a/src/shared/components/comment-node.tsx b/src/shared/components/comment-node.tsx index ab190ad3..5cbb07cd 100644 --- a/src/shared/components/comment-node.tsx +++ b/src/shared/components/comment-node.tsx @@ -205,7 +205,14 @@ export class CommentNode extends Component { onClick={linkEvent(node, this.handleCommentUpvote)} data-tippy-content={this.pointsTippy} > - {this.state.score} + + {this.state.score} + @@ -409,6 +416,7 @@ export class CommentNode extends Component { this, this.handleModRemoveShow )} + aria-label={i18n.t('remove')} > {i18n.t('remove')} @@ -419,6 +427,7 @@ export class CommentNode extends Component { this, this.handleModRemoveSubmit )} + aria-label={i18n.t('restore')} > {i18n.t('restore')} @@ -436,6 +445,7 @@ export class CommentNode extends Component { this, this.handleModBanFromCommunityShow )} + aria-label={i18n.t('ban')} > {i18n.t('ban')} @@ -446,6 +456,7 @@ export class CommentNode extends Component { this, this.handleModBanFromCommunitySubmit )} + aria-label={i18n.t('unban')} > {i18n.t('unban')} @@ -459,6 +470,11 @@ export class CommentNode extends Component { this, this.handleShowConfirmAppointAsMod )} + aria-label={ + this.isMod + ? i18n.t('remove_as_mod') + : i18n.t('appoint_as_mod') + } > {this.isMod ? i18n.t('remove_as_mod') @@ -466,7 +482,10 @@ export class CommentNode extends Component { ) : ( <> - @@ -484,6 +504,7 @@ export class CommentNode extends Component { this, this.handleCancelConfirmAppointAsMod )} + aria-label={i18n.t('no')} > {i18n.t('no')} @@ -502,12 +523,16 @@ export class CommentNode extends Component { this, this.handleShowConfirmTransferCommunity )} + aria-label={i18n.t('transfer_community')} > {i18n.t('transfer_community')} ) : ( <> - @@ -526,6 +552,7 @@ export class CommentNode extends Component { this .handleCancelShowConfirmTransferCommunity )} + aria-label={i18n.t('no')} > {i18n.t('no')} @@ -542,6 +569,7 @@ export class CommentNode extends Component { this, this.handleModBanShow )} + aria-label={i18n.t('ban_from_site')} > {i18n.t('ban_from_site')} @@ -552,6 +580,7 @@ export class CommentNode extends Component { this, this.handleModBanSubmit )} + aria-label={i18n.t('unban_from_site')} > {i18n.t('unban_from_site')} @@ -565,6 +594,11 @@ export class CommentNode extends Component { this, this.handleShowConfirmAppointAsAdmin )} + aria-label={ + this.isAdmin + ? i18n.t('remove_as_admin') + : i18n.t('appoint_as_admin') + } > {this.isAdmin ? i18n.t('remove_as_admin') @@ -581,6 +615,7 @@ export class CommentNode extends Component { this, this.handleAddAdmin )} + aria-label={i18n.t('yes')} > {i18n.t('yes')} @@ -590,6 +625,7 @@ export class CommentNode extends Component { this, this.handleCancelConfirmAppointAsAdmin )} + aria-label={i18n.t('no')} > {i18n.t('no')} @@ -608,12 +644,16 @@ export class CommentNode extends Component { this, this.handleShowConfirmTransferSite )} + aria-label={i18n.t('transfer_site')} > {i18n.t('transfer_site')} ) : ( <> - @@ -631,6 +672,7 @@ export class CommentNode extends Component { this, this.handleCancelShowConfirmTransferSite )} + aria-label={i18n.t('no')} > {i18n.t('no')} @@ -652,14 +694,25 @@ export class CommentNode extends Component { class="form-inline" onSubmit={linkEvent(this, this.handleModRemoveSubmit)} > + - @@ -702,7 +755,11 @@ export class CommentNode extends Component { {/* */} {/* */}
-
diff --git a/src/shared/components/communities.tsx b/src/shared/components/communities.tsx index e9fb81c2..e8dec415 100644 --- a/src/shared/components/communities.tsx +++ b/src/shared/components/communities.tsx @@ -198,6 +198,7 @@ export class Communities extends Component { > { required minLength={3} /> + diff --git a/src/shared/components/login.tsx b/src/shared/components/login.tsx index 94c685dd..ea37d1ed 100644 --- a/src/shared/components/login.tsx +++ b/src/shared/components/login.tsx @@ -253,6 +253,7 @@ export class Login extends Component { type="button" class="btn btn-secondary" onClick={linkEvent(this, this.handleRegenCaptcha)} + aria-label={i18n.t('captcha')} > diff --git a/src/shared/components/markdown-textarea.tsx b/src/shared/components/markdown-textarea.tsx index bc53c741..67d5c415 100644 --- a/src/shared/components/markdown-textarea.tsx +++ b/src/shared/components/markdown-textarea.tsx @@ -139,6 +139,9 @@ export class MarkdownTextArea extends Component< /> )} +
@@ -179,6 +182,7 @@ export class MarkdownTextArea extends Component< @@ -312,7 +322,12 @@ export class Navbar extends Component { > {this.state.unreadCount > 0 && ( - + {this.state.unreadCount} )} diff --git a/src/shared/components/post-form.tsx b/src/shared/components/post-form.tsx index 86e6603e..552776d9 100644 --- a/src/shared/components/post-form.tsx +++ b/src/shared/components/post-form.tsx @@ -27,7 +27,6 @@ import { debounce, isImage, toast, - randomStr, setupTippy, hostname, pictrsDeleteToast, @@ -72,7 +71,6 @@ interface PostFormState { } export class PostForm extends Component { - private id = `post-form-${randomStr()}`; private subscription: Subscription; private choices: any; private emptyState: PostFormState = { @@ -278,9 +276,7 @@ export class PostForm extends Component {
- +
{ class="btn btn-link btn-animate text-muted py-0" onClick={linkEvent(this, this.handleEditClick)} data-tippy-content={i18n.t('edit')} + aria-label={i18n.t('edit')} > @@ -648,6 +649,9 @@ export class PostListing extends Component { data-tippy-content={ !post_view.post.deleted ? i18n.t('delete') : i18n.t('restore') } + aria-label={ + !post_view.post.deleted ? i18n.t('delete') : i18n.t('restore') + } > { class="btn btn-link btn-animate text-muted py-0" onClick={linkEvent(this, this.handleViewSource)} data-tippy-content={i18n.t('view_source')} + aria-label={i18n.t('view_source')} > { data-tippy-content={ post_view.post.locked ? i18n.t('unlock') : i18n.t('lock') } + aria-label={ + post_view.post.locked ? i18n.t('unlock') : i18n.t('lock') + } > { ? i18n.t('unsticky') : i18n.t('sticky') } + aria-label={ + post_view.post.stickied + ? i18n.t('unsticky') + : i18n.t('sticky') + } > { @@ -731,6 +745,7 @@ export class PostListing extends Component { @@ -745,6 +760,7 @@ export class PostListing extends Component { this, this.handleModBanFromCommunityShow )} + aria-label={i18n.t('ban')} > {i18n.t('ban')} @@ -755,6 +771,7 @@ export class PostListing extends Component { this, this.handleModBanFromCommunitySubmit )} + aria-label={i18n.t('unban')} > {i18n.t('unban')} @@ -764,6 +781,11 @@ export class PostListing extends Component { ) : ( <> - @@ -816,6 +844,7 @@ export class PostListing extends Component { @@ -823,6 +852,7 @@ export class PostListing extends Component { @@ -831,6 +861,11 @@ export class PostListing extends Component { ) : ( <> - @@ -869,6 +909,7 @@ export class PostListing extends Component { this, this.handleCancelShowConfirmTransferSite )} + aria-label={i18n.t('no')} > {i18n.t('no')} @@ -890,14 +931,22 @@ export class PostListing extends Component { class="form-inline" onSubmit={linkEvent(this, this.handleModRemoveSubmit)} > + - @@ -905,12 +954,12 @@ export class PostListing extends Component { {this.state.showBanDialog && (
-
*/}
-