Skip to content
Snippets Groups Projects
Unverified Commit dd168726 authored by Jack Reed's avatar Jack Reed Committed by GitHub
Browse files

Merge pull request #3141 from ProjectMirador/accessibility

Accessibility tweaks
parents 0254d5a8 8706a5ac
No related branches found
No related tags found
No related merge requests found
import React from 'react'; import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import Paper from '@material-ui/core/Paper'; import Paper from '@material-ui/core/Paper';
import Typography from '@material-ui/core/Typography';
import { WindowCanvasNavigationControls } from '../../../src/components/WindowCanvasNavigationControls'; import { WindowCanvasNavigationControls } from '../../../src/components/WindowCanvasNavigationControls';
import ViewerInfo from '../../../src/containers/ViewerInfo'; import ViewerInfo from '../../../src/containers/ViewerInfo';
import ViewerNavigation from '../../../src/containers/ViewerNavigation'; import ViewerNavigation from '../../../src/containers/ViewerNavigation';
...@@ -35,9 +36,9 @@ describe('WindowCanvasNavigationControls', () => { ...@@ -35,9 +36,9 @@ describe('WindowCanvasNavigationControls', () => {
)).toBe(true); )).toBe(true);
}); });
it('renders nothing when visible=false', () => { it('renders only a screen-reader accessibile version when visible=false', () => {
wrapper = createWrapper({ visible: false }); wrapper = createWrapper({ visible: false });
expect(wrapper.matchesElement(<></>)).toBe(true); expect(wrapper.matchesElement(<Typography variant="srOnly"><ViewerInfo /></Typography>)).toBe(true);
}); });
it('sets the proper class/ZoomControls prop dependent on the size/width prop', () => { it('sets the proper class/ZoomControls prop dependent on the size/width prop', () => {
......
...@@ -26,7 +26,7 @@ export class Branding extends Component { ...@@ -26,7 +26,7 @@ export class Branding extends Component {
target="_blank" target="_blank"
rel="noopener" rel="noopener"
> >
<MiradorIcon titleAccess="About Project Mirador" fontSize="large" /> <MiradorIcon aria-label={t('aboutMirador')} titleAccess={t('aboutMirador')} fontSize="large" />
</IconButton> </IconButton>
</Typography> </Typography>
</div> </div>
......
...@@ -50,6 +50,8 @@ export class ThumbnailCanvasGrouping extends PureComponent { ...@@ -50,6 +50,8 @@ export class ThumbnailCanvasGrouping extends PureComponent {
width: (Number.isInteger(style.width)) ? style.width - SPACING : null, width: (Number.isInteger(style.width)) ? style.width - SPACING : null,
}} }}
className={ns('thumbnail-nav-container')} className={ns('thumbnail-nav-container')}
role="gridcell"
aria-colindex={index + 1}
> >
<div <div
role="button" role="button"
......
...@@ -204,6 +204,7 @@ export class ThumbnailNavigation extends Component { ...@@ -204,6 +204,7 @@ export class ThumbnailNavigation extends Component {
onKeyUp={this.handleKeyUp} onKeyUp={this.handleKeyUp}
role="grid" role="grid"
> >
<div role="row" style={{ height: '100%', width: '100%' }}>
<AutoSizer <AutoSizer
defaultHeight={100} defaultHeight={100}
defaultWidth={400} defaultWidth={400}
...@@ -223,6 +224,7 @@ export class ThumbnailNavigation extends Component { ...@@ -223,6 +224,7 @@ export class ThumbnailNavigation extends Component {
</List> </List>
)} )}
</AutoSizer> </AutoSizer>
</div>
</Paper> </Paper>
); );
} }
......
...@@ -2,6 +2,7 @@ import React, { Component } from 'react'; ...@@ -2,6 +2,7 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import classNames from 'classnames'; import classNames from 'classnames';
import Paper from '@material-ui/core/Paper'; import Paper from '@material-ui/core/Paper';
import Typography from '@material-ui/core/Typography';
import ZoomControls from '../containers/ZoomControls'; import ZoomControls from '../containers/ZoomControls';
import ViewerInfo from '../containers/ViewerInfo'; import ViewerInfo from '../containers/ViewerInfo';
import ViewerNavigation from '../containers/ViewerNavigation'; import ViewerNavigation from '../containers/ViewerNavigation';
...@@ -26,7 +27,7 @@ export class WindowCanvasNavigationControls extends Component { ...@@ -26,7 +27,7 @@ export class WindowCanvasNavigationControls extends Component {
classes, visible, windowId, zoomToWorld, classes, visible, windowId, zoomToWorld,
} = this.props; } = this.props;
if (!visible) return (<></>); if (!visible) return (<Typography variant="srOnly" component="div"><ViewerInfo windowId={windowId} /></Typography>);
return ( return (
<Paper <Paper
......
...@@ -7,11 +7,9 @@ import SvgIcon from '@material-ui/core/SvgIcon'; ...@@ -7,11 +7,9 @@ import SvgIcon from '@material-ui/core/SvgIcon';
export default function MiradorIcon(props) { export default function MiradorIcon(props) {
return ( return (
<SvgIcon viewBox="0 0 60 55" {...props}> <SvgIcon viewBox="0 0 60 55" {...props}>
<svg xmlns="http://www.w3.org/2000/svg" width="60" height="55" viewBox="0 0 60 55">
<rect width="18" height="55" /> <rect width="18" height="55" />
<rect width="18" height="55" transform="translate(42)" /> <rect width="18" height="55" transform="translate(42)" />
<rect width="18" height="34" transform="translate(21)" /> <rect width="18" height="34" transform="translate(21)" />
</svg>
</SvgIcon> </SvgIcon>
); );
} }
{ {
"translation": { "translation": {
"aboutMirador": "About Project Mirador",
"aboutThisItem": "About this item", "aboutThisItem": "About this item",
"addedFromUrl": "(Added from URL)", "addedFromUrl": "(Added from URL)",
"addManifestUrl": "Resource location", "addManifestUrl": "Resource location",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment