Skip to content

Commit

Permalink
Replace srOnly class with visually-hidden style
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeer committed Mar 30, 2023
1 parent cbb8df4 commit a229d62
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe('WindowCanvasNavigationControls', () => {

it('renders only a screen-reader accessibile version when visible=false', () => {
const { container } = render(<Subject visible={false} />);
expect(container.firstChild.classList[1]).toMatch(/srOnly/); // eslint-disable-line testing-library/no-node-access
expect(container.firstChild).toHaveStyle({ height: '1px', margin: '-1px', width: '1px' }); // eslint-disable-line testing-library/no-node-access
});

it('stacks the nav controls on small width screens', () => {
Expand Down
3 changes: 2 additions & 1 deletion src/components/WindowCanvasNavigationControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
import classNames from 'classnames';
import Paper from '@mui/material/Paper';
import Typography from '@mui/material/Typography';
import { visuallyHidden } from '@mui/utils';
import ZoomControls from '../containers/ZoomControls';
import ViewerInfo from '../containers/ViewerInfo';
import ViewerNavigation from '../containers/ViewerNavigation';
Expand All @@ -28,7 +29,7 @@ export class WindowCanvasNavigationControls extends Component {
classes, visible, windowId, zoomToWorld,
} = this.props;

if (!visible) return (<Typography variant="srOnly" component="div"><ViewerInfo windowId={windowId} /></Typography>);
if (!visible) return (<Typography style={visuallyHidden} component="div"><ViewerInfo windowId={windowId} /></Typography>);

return (
<Paper
Expand Down
3 changes: 2 additions & 1 deletion src/components/Workspace.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
import classNames from 'classnames';
import Grid from '@mui/material/Grid';
import Typography from '@mui/material/Typography';
import { visuallyHidden } from '@mui/utils';
import Window from '../containers/Window';
import WorkspaceMosaic from '../containers/WorkspaceMosaic';
import WorkspaceElastic from '../containers/WorkspaceElastic';
Expand Down Expand Up @@ -121,7 +122,7 @@ export class Workspace extends Component {
)
}
>
<Typography variant="srOnly" component="h1">{t('miradorViewer')}</Typography>
<Typography style={visuallyHidden} component="h1">{t('miradorViewer')}</Typography>
{this.workspaceByType()}
</div>
</IIIFDropTarget>
Expand Down
3 changes: 2 additions & 1 deletion src/components/WorkspaceAdd.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import List from '@mui/material/List';
import Paper from '@mui/material/Paper';
import Toolbar from '@mui/material/Toolbar';
import Typography from '@mui/material/Typography';
import { visuallyHidden } from '@mui/utils';
import ns from '../config/css-ns';
import ManifestForm from '../containers/ManifestForm';
import ManifestListItem from '../containers/ManifestListItem';
Expand Down Expand Up @@ -115,7 +116,7 @@ export class WorkspaceAdd extends Component {
</Grid>
) : (
<Paper className={classes.list}>
<Typography variant="srOnly" component="h1">{t('miradorResources')}</Typography>
<Typography style={visuallyHidden} component="h1">{t('miradorResources')}</Typography>
<PluginHook {...this.props} />
<List disablePadding>
{manifestList}
Expand Down

0 comments on commit a229d62

Please sign in to comment.