Add jsx-a11y eslint plugin (#7434)

* add matrix-org a11y eslint plgin

Signed-off-by: Kerry Archibald <kerrya@element.io>

* add eslint a11y, enable and fix anchor-has-content rule

Signed-off-by: Kerry Archibald <kerrya@element.io>

* enable and fix jsx-a11y/no-redundant-roles

Signed-off-by: Kerry Archibald <kerrya@element.io>

* remove debug

Signed-off-by: Kerry Archibald <kerrya@element.io>

* i18n

Signed-off-by: Kerry Archibald <kerrya@element.io>

* use jsx-a11y via matrix-org-eslint

Signed-off-by: Kerry Archibald <kerrya@element.io>
This commit is contained in:
Kerry 2022-01-03 18:51:58 +01:00 committed by GitHub
parent 03f5a3c3e6
commit 846fbfa2a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 122 additions and 12 deletions

View file

@ -958,7 +958,7 @@ export default class ScrollPanel extends React.Component<IProps> {
>
{ this.props.fixedChildren }
<div className="mx_RoomView_messageListWrapper">
<ol ref={this.itemlist} className="mx_RoomView_MessageList" aria-live="polite" role="list">
<ol ref={this.itemlist} className="mx_RoomView_MessageList" aria-live="polite">
{ this.props.children }
</ol>
</div>

View file

@ -88,7 +88,7 @@ export default class TagTileContextMenu extends React.Component {
let createSpaceOption;
if (GroupStore.isUserPrivileged(this.props.tag)) {
createSpaceOption = <>
<hr className="mx_TagTileContextMenu_separator" role="separator" />
<hr className="mx_TagTileContextMenu_separator" />
<MenuItem className="mx_TagTileContextMenu_item mx_TagTileContextMenu_createSpace" onClick={this._onCreateSpaceClick}>
{ _t("Create Space") }
</MenuItem>
@ -99,10 +99,10 @@ export default class TagTileContextMenu extends React.Component {
<MenuItem className="mx_TagTileContextMenu_item mx_TagTileContextMenu_viewCommunity" onClick={this._onViewCommunityClick}>
{ _t('View Community') }
</MenuItem>
{ (moveUp || moveDown) ? <hr className="mx_TagTileContextMenu_separator" role="separator" /> : null }
{ (moveUp || moveDown) ? <hr className="mx_TagTileContextMenu_separator" /> : null }
{ moveUp }
{ moveDown }
<hr className="mx_TagTileContextMenu_separator" role="separator" />
<hr className="mx_TagTileContextMenu_separator" />
<MenuItem className="mx_TagTileContextMenu_item mx_TagTileContextMenu_hideCommunity" onClick={this._onRemoveClick}>
{ _t("Unpin") }
</MenuItem>

View file

@ -252,12 +252,13 @@ export default class MFileBody extends React.Component<IProps, IState> {
<span className="mx_MFileBody">
{ placeholder }
{ showDownloadLink && <div className="mx_MFileBody_download">
<div style={{ display: "none" }}>
<div aria-hidden style={{ display: "none" }}>
{ /*
* Add dummy copy of the "a" tag
* We'll use it to learn how the download link
* would have been styled if it was rendered inline.
*/ }
{ /* eslint-disable-next-line jsx-a11y/anchor-has-content */ }
<a ref={this.dummyLink} />
</div>
{ /*

View file

@ -20,6 +20,7 @@ import classNames from 'classnames';
import { replaceableComponent } from "../../../utils/replaceableComponent";
import { MatrixClientPeg } from "../../../MatrixClientPeg";
import { _t } from '../../../languageHandler';
interface IProps {
mxEvent: MatrixEvent;
@ -75,9 +76,9 @@ export default class ViewSourceEvent extends React.PureComponent<IProps, IState>
return <span className={classes}>
{ content }
<a
<button
title={_t('toggle event')}
className="mx_ViewSourceEvent_toggle"
href="#"
onClick={this.onToggle}
/>
</span>;

View file

@ -2120,6 +2120,7 @@
"edited": "edited",
"Submit logs": "Submit logs",
"Can't load this message": "Can't load this message",
"toggle event": "toggle event",
"Share location": "Share location",
"Share custom location": "Share custom location",
"Share my current location as a once off": "Share my current location as a once off",