From 209b65243a82d1131ce801e1f485c1488df04403 Mon Sep 17 00:00:00 2001 From: Kerry Date: Wed, 15 Mar 2023 10:25:11 +1300 Subject: [PATCH] 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" --- .eslintrc.js | 2 -- .../elements/DesktopCapturerSourcePicker.tsx | 2 +- .../views/elements/SearchWarning.tsx | 2 +- src/components/views/messages/MStickerBody.tsx | 2 ++ .../views/room_settings/UrlPreviewSettings.tsx | 18 ++++++++---------- src/components/views/rooms/EntityTile.tsx | 7 ++++++- src/components/views/rooms/MessageComposer.tsx | 2 ++ src/i18n/strings/en_EN.json | 3 ++- 8 files changed, 22 insertions(+), 16 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index f448c78cd4..568a106ee6 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -81,11 +81,9 @@ module.exports = { // There are too many a11y violations to fix at once // Turn violated rules off until they are fixed - "jsx-a11y/alt-text": "off", "jsx-a11y/aria-activedescendant-has-tabindex": "off", "jsx-a11y/click-events-have-key-events": "off", "jsx-a11y/interactive-supports-focus": "off", - "jsx-a11y/label-has-associated-control": "off", "jsx-a11y/media-has-caption": "off", "jsx-a11y/mouse-events-have-key-events": "off", "jsx-a11y/no-autofocus": "off", diff --git a/src/components/views/elements/DesktopCapturerSourcePicker.tsx b/src/components/views/elements/DesktopCapturerSourcePicker.tsx index 7be62a8999..cc1b7d1ffd 100644 --- a/src/components/views/elements/DesktopCapturerSourcePicker.tsx +++ b/src/components/views/elements/DesktopCapturerSourcePicker.tsx @@ -69,7 +69,7 @@ export class ExistingSource extends React.Component { title={this.props.source.name} onClick={this.onClick} > - + {this.props.source.name} {this.props.source.name} ); diff --git a/src/components/views/elements/SearchWarning.tsx b/src/components/views/elements/SearchWarning.tsx index 421f550ff6..817e7dcc7c 100644 --- a/src/components/views/elements/SearchWarning.tsx +++ b/src/components/views/elements/SearchWarning.tsx @@ -72,7 +72,7 @@ export default function SearchWarning({ isRoomEncrypted, kind }: IProps): JSX.El let text: ReactNode | undefined; let logo: JSX.Element | undefined; if (desktopBuilds?.get("available")) { - logo = ; + logo = {_t("Desktop; const buildUrl = desktopBuilds.get("url"); switch (kind) { case WarningKind.Files: diff --git a/src/components/views/messages/MStickerBody.tsx b/src/components/views/messages/MStickerBody.tsx index 4030b8e932..092b948fc6 100644 --- a/src/components/views/messages/MStickerBody.tsx +++ b/src/components/views/messages/MStickerBody.tsx @@ -50,6 +50,8 @@ export default class MStickerBody extends MImageBody { if (this.props.mxEvent.getContent().info?.[BLURHASH_FIELD]) return super.getPlaceholder(width, height); return ( { if (SettingsStore.canSetValue("urlPreviewsEnabled", roomId, SettingLevel.ROOM)) { previewsForRoom = ( - + ); } else { let str = _td("URL previews are enabled by default for participants in this room."); if (!SettingsStore.getValueAt(SettingLevel.ROOM, "urlPreviewsEnabled", roomId, /*explicit=*/ true)) { str = _td("URL previews are disabled by default for participants in this room."); } - previewsForRoom = ; + previewsForRoom =
{_t(str)}
; } } else { previewsForAccount = _t( @@ -127,7 +125,7 @@ export default class UrlPreviewSettings extends React.Component { return ( {previewsForRoom} - + {previewsForRoomAccount} ); } diff --git a/src/components/views/rooms/EntityTile.tsx b/src/components/views/rooms/EntityTile.tsx index 16523918aa..647ea82751 100644 --- a/src/components/views/rooms/EntityTile.tsx +++ b/src/components/views/rooms/EntityTile.tsx @@ -161,7 +161,12 @@ export default class EntityTile extends React.PureComponent { if (this.props.showInviteButton) { inviteButton = (
- + {_t("Invite")}
); } diff --git a/src/components/views/rooms/MessageComposer.tsx b/src/components/views/rooms/MessageComposer.tsx index 86e0256275..8fc647b77a 100644 --- a/src/components/views/rooms/MessageComposer.tsx +++ b/src/components/views/rooms/MessageComposer.tsx @@ -538,6 +538,8 @@ export class MessageComposer extends React.Component {
diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index ad8d4e2abe..0050959987 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -1903,6 +1903,7 @@ "Edit message": "Edit message", "Emoji": "Emoji", "Mod": "Mod", + "Invite": "Invite", "From a thread": "From a thread", "This event could not be displayed": "This event could not be displayed", " in %(room)s": " in %(room)s", @@ -2009,7 +2010,6 @@ "Hide Widgets": "Hide Widgets", "Show Widgets": "Show Widgets", "Search": "Search", - "Invite": "Invite", "Close call": "Close call", "View chat timeline": "View chat timeline", "Room options": "Room options", @@ -2631,6 +2631,7 @@ "Edit topic": "Edit topic", "Click to read topic": "Click to read topic", "Message search initialisation failed, check your settings for more information": "Message search initialisation failed, check your settings for more information", + "Desktop app logo": "Desktop app logo", "Use the Desktop app to see all encrypted files": "Use the Desktop app to see all encrypted files", "Use the Desktop app to search encrypted messages": "Use the Desktop app to search encrypted messages", "This version of %(brand)s does not support viewing some encrypted files": "This version of %(brand)s does not support viewing some encrypted files",