Finish adding aria labels
This commit is contained in:
parent
cee22c3277
commit
c708af1465
3 changed files with 31 additions and 7 deletions
|
@ -53,9 +53,10 @@ const ShareURL = ({ value }) => {
|
||||||
<button
|
<button
|
||||||
className="collection-share__button"
|
className="collection-share__button"
|
||||||
onClick={() => setShowURL(!showURL)}
|
onClick={() => setShowURL(!showURL)}
|
||||||
|
aria-label="Show collection share URL"
|
||||||
>
|
>
|
||||||
<span>Share</span>
|
<span>Share</span>
|
||||||
<DropdownArrowIcon className="collection-share__arrow" />
|
<DropdownArrowIcon className="collection-share__arrow" focusable="false" aria-hidden="true" />
|
||||||
</button>
|
</button>
|
||||||
{ showURL &&
|
{ showURL &&
|
||||||
<div className="collection__share-dropdown">
|
<div className="collection__share-dropdown">
|
||||||
|
@ -97,8 +98,9 @@ class CollectionItemRowBase extends React.Component {
|
||||||
<button
|
<button
|
||||||
className="collection-row__remove-button"
|
className="collection-row__remove-button"
|
||||||
onClick={this.handleSketchRemove}
|
onClick={this.handleSketchRemove}
|
||||||
|
aria-label="Remove sketch from collection"
|
||||||
>
|
>
|
||||||
<RemoveIcon title="Remove" />
|
<RemoveIcon focusable="false" aria-hidden="true" />
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>);
|
</tr>);
|
||||||
|
@ -295,21 +297,43 @@ class Collection extends React.Component {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_getButtonLabel = (fieldName, displayName) => {
|
||||||
|
const { field, direction } = this.props.sorting;
|
||||||
|
let buttonLabel;
|
||||||
|
if (field !== fieldName) {
|
||||||
|
if (field === 'name') {
|
||||||
|
buttonLabel = `Sort by ${displayName} ascending.`;
|
||||||
|
} else {
|
||||||
|
buttonLabel = `Sort by ${displayName} descending.`;
|
||||||
|
}
|
||||||
|
} else if (direction === SortingActions.DIRECTION.ASC) {
|
||||||
|
buttonLabel = `Sort by ${displayName} descending.`;
|
||||||
|
} else {
|
||||||
|
buttonLabel = `Sort by ${displayName} ascending.`;
|
||||||
|
}
|
||||||
|
return buttonLabel;
|
||||||
|
}
|
||||||
|
|
||||||
_renderFieldHeader(fieldName, displayName) {
|
_renderFieldHeader(fieldName, displayName) {
|
||||||
const { field, direction } = this.props.sorting;
|
const { field, direction } = this.props.sorting;
|
||||||
const headerClass = classNames({
|
const headerClass = classNames({
|
||||||
'sketches-table__header': true,
|
'sketches-table__header': true,
|
||||||
'sketches-table__header--selected': field === fieldName
|
'sketches-table__header--selected': field === fieldName
|
||||||
});
|
});
|
||||||
|
const buttonLabel = this._getButtonLabel(fieldName, displayName);
|
||||||
return (
|
return (
|
||||||
<th scope="col">
|
<th scope="col">
|
||||||
<button className="sketch-list__sort-button" onClick={() => this.props.toggleDirectionForField(fieldName)}>
|
<button
|
||||||
|
className="sketch-list__sort-button"
|
||||||
|
onClick={() => this.props.toggleDirectionForField(fieldName)}
|
||||||
|
aria-label={buttonLabel}
|
||||||
|
>
|
||||||
<span className={headerClass}>{displayName}</span>
|
<span className={headerClass}>{displayName}</span>
|
||||||
{field === fieldName && direction === SortingActions.DIRECTION.ASC &&
|
{field === fieldName && direction === SortingActions.DIRECTION.ASC &&
|
||||||
<ArrowUpIcon />
|
<ArrowUpIcon role="img" aria-label="Ascending" focusable="false" />
|
||||||
}
|
}
|
||||||
{field === fieldName && direction === SortingActions.DIRECTION.DESC &&
|
{field === fieldName && direction === SortingActions.DIRECTION.DESC &&
|
||||||
<ArrowDownIcon />
|
<ArrowDownIcon role="img" aria-label="Descending" focusable="false" />
|
||||||
}
|
}
|
||||||
</button>
|
</button>
|
||||||
</th>
|
</th>
|
||||||
|
|
|
@ -9,7 +9,7 @@ function GithubButton(props) {
|
||||||
className="github-button"
|
className="github-button"
|
||||||
href="/auth/github"
|
href="/auth/github"
|
||||||
>
|
>
|
||||||
<GithubIcon className="github-icon" />
|
<GithubIcon className="github-icon" role="img" aria-label="GitHub Logo" focusable="false" />
|
||||||
<span>{props.buttonText}</span>
|
<span>{props.buttonText}</span>
|
||||||
</a>
|
</a>
|
||||||
);
|
);
|
||||||
|
|
|
@ -9,7 +9,7 @@ function GoogleButton(props) {
|
||||||
className="google-button"
|
className="google-button"
|
||||||
href="/auth/google/"
|
href="/auth/google/"
|
||||||
>
|
>
|
||||||
<GoogleIcon className="google-icon" />
|
<GoogleIcon className="google-icon" role="img" aria-label="Google Logo" focusable="false" />
|
||||||
<span>{props.buttonText}</span>
|
<span>{props.buttonText}</span>
|
||||||
</a>
|
</a>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue