Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 209b652

Browse files
author
Kerry
authored
Enable "jsx-a11y/alt-text" and "jsx-a11y/label-has-associated-control" lint rules (#10361)
* enable "jsx-a11y/alt-text" lint rule * enable "jsx-a11y/label-has-associated-control"
1 parent e0e83bd commit 209b652

File tree

8 files changed

+22
-16
lines changed

8 files changed

+22
-16
lines changed

.eslintrc.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,9 @@ module.exports = {
8181

8282
// There are too many a11y violations to fix at once
8383
// Turn violated rules off until they are fixed
84-
"jsx-a11y/alt-text": "off",
8584
"jsx-a11y/aria-activedescendant-has-tabindex": "off",
8685
"jsx-a11y/click-events-have-key-events": "off",
8786
"jsx-a11y/interactive-supports-focus": "off",
88-
"jsx-a11y/label-has-associated-control": "off",
8987
"jsx-a11y/media-has-caption": "off",
9088
"jsx-a11y/mouse-events-have-key-events": "off",
9189
"jsx-a11y/no-autofocus": "off",

src/components/views/elements/DesktopCapturerSourcePicker.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export class ExistingSource extends React.Component<ExistingSourceIProps> {
6969
title={this.props.source.name}
7070
onClick={this.onClick}
7171
>
72-
<img className={thumbnailClasses} src={this.props.source.thumbnailURL} />
72+
<img alt={this.props.source.name} className={thumbnailClasses} src={this.props.source.thumbnailURL} />
7373
<span className="mx_desktopCapturerSourcePicker_source_name">{this.props.source.name}</span>
7474
</AccessibleButton>
7575
);

src/components/views/elements/SearchWarning.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export default function SearchWarning({ isRoomEncrypted, kind }: IProps): JSX.El
7272
let text: ReactNode | undefined;
7373
let logo: JSX.Element | undefined;
7474
if (desktopBuilds?.get("available")) {
75-
logo = <img src={desktopBuilds.get("logo")} />;
75+
logo = <img alt={_t("Desktop app logo")} src={desktopBuilds.get("logo")} />;
7676
const buildUrl = desktopBuilds.get("url");
7777
switch (kind) {
7878
case WarningKind.Files:

src/components/views/messages/MStickerBody.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ export default class MStickerBody extends MImageBody {
5050
if (this.props.mxEvent.getContent().info?.[BLURHASH_FIELD]) return super.getPlaceholder(width, height);
5151
return (
5252
<img
53+
aria-hidden
54+
alt=""
5355
className="mx_MStickerBody_placeholder"
5456
src={require("../../../../res/img/icons-show-stickers.svg").default}
5557
width="80"

src/components/views/room_settings/UrlPreviewSettings.tsx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,21 +79,19 @@ export default class UrlPreviewSettings extends React.Component<IProps> {
7979

8080
if (SettingsStore.canSetValue("urlPreviewsEnabled", roomId, SettingLevel.ROOM)) {
8181
previewsForRoom = (
82-
<label>
83-
<SettingsFlag
84-
name="urlPreviewsEnabled"
85-
level={SettingLevel.ROOM}
86-
roomId={roomId}
87-
isExplicit={true}
88-
/>
89-
</label>
82+
<SettingsFlag
83+
name="urlPreviewsEnabled"
84+
level={SettingLevel.ROOM}
85+
roomId={roomId}
86+
isExplicit={true}
87+
/>
9088
);
9189
} else {
9290
let str = _td("URL previews are enabled by default for participants in this room.");
9391
if (!SettingsStore.getValueAt(SettingLevel.ROOM, "urlPreviewsEnabled", roomId, /*explicit=*/ true)) {
9492
str = _td("URL previews are disabled by default for participants in this room.");
9593
}
96-
previewsForRoom = <label>{_t(str)}</label>;
94+
previewsForRoom = <div>{_t(str)}</div>;
9795
}
9896
} else {
9997
previewsForAccount = _t(
@@ -127,7 +125,7 @@ export default class UrlPreviewSettings extends React.Component<IProps> {
127125
return (
128126
<SettingsFieldset legend={_t("URL Previews")} description={description}>
129127
{previewsForRoom}
130-
<label>{previewsForRoomAccount}</label>
128+
{previewsForRoomAccount}
131129
</SettingsFieldset>
132130
);
133131
}

src/components/views/rooms/EntityTile.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,12 @@ export default class EntityTile extends React.PureComponent<IProps, IState> {
161161
if (this.props.showInviteButton) {
162162
inviteButton = (
163163
<div className="mx_EntityTile_invite">
164-
<img src={require("../../../../res/img/plus.svg").default} width="16" height="16" />
164+
<img
165+
alt={_t("Invite")}
166+
src={require("../../../../res/img/plus.svg").default}
167+
width="16"
168+
height="16"
169+
/>
165170
</div>
166171
);
167172
}

src/components/views/rooms/MessageComposer.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,8 @@ export class MessageComposer extends React.Component<IProps, IState> {
538538
<div className="mx_MessageComposer_replaced_wrapper" key="room_replaced">
539539
<div className="mx_MessageComposer_replaced_valign">
540540
<img
541+
aria-hidden
542+
alt=""
541543
className="mx_MessageComposer_roomReplaced_icon"
542544
src={require("../../../../res/img/room_replaced.svg").default}
543545
/>

src/i18n/strings/en_EN.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1903,6 +1903,7 @@
19031903
"Edit message": "Edit message",
19041904
"Emoji": "Emoji",
19051905
"Mod": "Mod",
1906+
"Invite": "Invite",
19061907
"From a thread": "From a thread",
19071908
"This event could not be displayed": "This event could not be displayed",
19081909
" in <strong>%(room)s</strong>": " in <strong>%(room)s</strong>",
@@ -2009,7 +2010,6 @@
20092010
"Hide Widgets": "Hide Widgets",
20102011
"Show Widgets": "Show Widgets",
20112012
"Search": "Search",
2012-
"Invite": "Invite",
20132013
"Close call": "Close call",
20142014
"View chat timeline": "View chat timeline",
20152015
"Room options": "Room options",
@@ -2631,6 +2631,7 @@
26312631
"Edit topic": "Edit topic",
26322632
"Click to read topic": "Click to read topic",
26332633
"Message search initialisation failed, check <a>your settings</a> for more information": "Message search initialisation failed, check <a>your settings</a> for more information",
2634+
"Desktop app logo": "Desktop app logo",
26342635
"Use the <a>Desktop app</a> to see all encrypted files": "Use the <a>Desktop app</a> to see all encrypted files",
26352636
"Use the <a>Desktop app</a> to search encrypted messages": "Use the <a>Desktop app</a> to search encrypted messages",
26362637
"This version of %(brand)s does not support viewing some encrypted files": "This version of %(brand)s does not support viewing some encrypted files",

0 commit comments

Comments
 (0)