Skip to content

Commit

Permalink
ui: accessibility upgrades
Browse files Browse the repository at this point in the history
*Added alt-text to images
*Increased color contrast on the cancel button
*Added jsx-a11y linter - recommend to provide suggestion but not errors.
*Added language to the page, removed user-no-scale
*rearranged navigation to be a page region
*added titles to pagination buttons
*added skip-link for the repetitive page content
*added aria-expanded to filter buttons
*Document title updates on page change
  • Loading branch information
dayander authored Jul 15, 2019
1 parent fafb486 commit 96a372c
Show file tree
Hide file tree
Showing 23 changed files with 272 additions and 77 deletions.
3 changes: 2 additions & 1 deletion web/src/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ module.exports = {
parserOptions: {
ecmaFeatures: { legacyDecorators: true },
},
plugins: ['cypress', 'prettier'],
plugins: ['cypress', 'prettier', 'jsx-a11y'],
extends: [
'standard',
'standard-jsx',
'plugin:cypress/recommended',
'plugin:prettier/recommended',
'plugin:jsx-a11y/recommended',
],
rules: {
'prettier/prettier': 'error',
Expand Down
17 changes: 14 additions & 3 deletions web/src/app/details/DetailsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ const styles = theme => ({
[theme.breakpoints.up('md')]: { float: 'left' },
margin: 20,
},
mainHeading: {
fontSize: '1.5rem',
},
})

const mapStateToProps = state => {
Expand Down Expand Up @@ -125,12 +128,20 @@ export default class DetailsPage extends React.PureComponent {
<Card>
<CardContent>
{icon && <div className={classes.iconContainer}>{icon}</div>}
<Typography variant='h5'>{title}</Typography>
<Typography name='details' variant='subtitle1'>
<Typography
data-cy='details-heading'
className={classes.mainHeading}
component='h2'
>
{title}
</Typography>
<Typography data-cy='details' variant='subtitle1'>
<Markdown value={details} />
</Typography>
{titleFooter && (
<Typography variant='subtitle1'>{titleFooter}</Typography>
<Typography variant='subtitle1' data-cy='title-footer'>
{titleFooter}
</Typography>
)}
</CardContent>
</Card>
Expand Down
2 changes: 1 addition & 1 deletion web/src/app/escalation-policies/PolicyStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export default class PolicyStep extends Component {
<Grid container spacing={2}>
<Grid item className={classes.centerFlex}>
<Typography variant='subtitle1'>
<strong>Step #{this.getStepNumber(step.id)}:</strong>
<b>Step #{this.getStepNumber(step.id)}:</b>
</Typography>
</Grid>
<Grid item xs={10}>
Expand Down
2 changes: 2 additions & 0 deletions web/src/app/icons/components/Icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export class Slack extends Component {
{...except(this.props, 'classes')}
width={20}
height={20}
alt='Slack'
/>
)
}
Expand All @@ -76,6 +77,7 @@ export class SlackBW extends Component {
{...except(this.props, 'classes')}
width={20}
height={20}
alt='Slack'
/>
)
}
Expand Down
2 changes: 2 additions & 0 deletions web/src/app/lists/PaginatedList.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class PaginationControls extends React.PureComponent {
<Grid container item justify='flex-end' className={classes.controls}>
<Grid item>
<IconButton
title='back page'
data-cy='back-button'
disabled={!onBack}
onClick={() => {
Expand All @@ -78,6 +79,7 @@ class PaginationControls extends React.PureComponent {
</Grid>
<Grid item>
<IconButton
title='next page'
data-cy='next-button'
disabled={!onNext}
onClick={() => {
Expand Down
4 changes: 3 additions & 1 deletion web/src/app/main/NewApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import LazyWideSideBar from './WideSideBar'
import LazyNewUserSetup from './components/NewUserSetup'
import Login from './components/Login'
import URLErrorDialog from './URLErrorDialog'
import { SkipToContentLink } from '../util/SkipToContentLink'

const drawerWidth = '10.5em'

Expand Down Expand Up @@ -83,6 +84,7 @@ export default class App extends React.PureComponent {
data-cy='app-bar'
data-cy-format={cyFormat}
>
<SkipToContentLink />
<Toolbar className={classes.toolbar}>
<ToolbarAction
handleShowMobileSidebar={() =>
Expand Down Expand Up @@ -116,7 +118,7 @@ export default class App extends React.PureComponent {

<URLErrorDialog />

<main className={classes.main} style={{ marginLeft }}>
<main id='content' className={classes.main} style={{ marginLeft }}>
<div className={classes.toolbar} />
<ErrorBoundary>
<LazyNewUserSetup />
Expand Down
2 changes: 1 addition & 1 deletion web/src/app/main/components/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export default class Login extends Component {
// create login button
let loginButton = null
const loginIcon = logoUrl ? (
<img src={logoUrl} className={classes.loginIcon} />
<img alt='GoAlert' src={logoUrl} className={classes.loginIcon} />
) : null
if (fields) {
loginButton = (
Expand Down
86 changes: 44 additions & 42 deletions web/src/app/main/components/SideBarDrawerList.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,56 +154,58 @@ export default class SideBarDrawerList extends React.PureComponent {
const { classes } = this.props

return (
<List className={classes.list} data-cy='nav-list'>
<div className={classes.logoDiv}>
<React.Fragment>
<div aria-hidden className={classes.logoDiv}>
<img
className={classes.logo}
height={32}
src={require('../../public/goalert-alt-logo-scaled.png')}
alt=''
/>
</div>
<Divider />

{routeConfig
.filter(cfg => cfg.nav !== false)
.map((cfg, idx) =>
this.renderSidebarNavLink(
navIcons[cfg.title],
getPath(cfg),
cfg.title,
idx,
),
)}

<RequireConfig isAdmin>
<Divider />
{this.renderAdmin()}
</RequireConfig>

<Divider />
{this.renderSidebarNavLink(WizardIcon, '/wizard', 'Wizard')}
<Config>
{cfg =>
cfg['Feedback.Enable'] &&
this.renderFeedback(
cfg['Feedback.OverrideURL'] ||
'https://www.surveygizmo.com/s3/4106900/GoAlert-Feedback',
)
}
</Config>
{this.renderSidebarLink(
LogoutIcon,
'/api/v2/identity/logout',
'Logout',
{
onClick: e => {
e.preventDefault()
this.props.logout()
<List role='navigation' className={classes.list} data-cy='nav-list'>
{routeConfig
.filter(cfg => cfg.nav !== false)
.map((cfg, idx) =>
this.renderSidebarNavLink(
navIcons[cfg.title],
getPath(cfg),
cfg.title,
idx,
),
)}

<RequireConfig isAdmin>
<Divider aria-hidden />
{this.renderAdmin()}
</RequireConfig>

<Divider aria-hidden />
{this.renderSidebarNavLink(WizardIcon, '/wizard', 'Wizard')}
<Config>
{cfg =>
cfg['Feedback.Enable'] &&
this.renderFeedback(
cfg['Feedback.OverrideURL'] ||
'https://www.surveygizmo.com/s3/4106900/GoAlert-Feedback',
)
}
</Config>
{this.renderSidebarLink(
LogoutIcon,
'/api/v2/identity/logout',
'Logout',
{
onClick: e => {
e.preventDefault()
this.props.logout()
},
},
},
)}
{this.renderSidebarNavLink(CurrentUserAvatar, '/profile', 'Profile')}
</List>
)}
{this.renderSidebarNavLink(CurrentUserAvatar, '/profile', 'Profile')}
</List>
</React.Fragment>
)
}
}
4 changes: 3 additions & 1 deletion web/src/app/main/components/ToolbarTitle.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const styles = {
title: {
padding: '0 4px 0 4px',
flex: 1, // pushes toolbar actions to the right
fontSize: '1.25rem',
},
}

Expand Down Expand Up @@ -116,12 +117,13 @@ const mapStateToProps = state => {
@connect(mapStateToProps)
export default class ToolbarTitle extends React.Component {
renderTitle = title => {
document.title = `Go Alert - ${title}`
return (
<Typography
className={this.props.classes.title}
color='inherit'
noWrap
variant='h6'
component='h1'
>
{title.replace('On Call', 'On-Call')}
</Typography>
Expand Down
18 changes: 17 additions & 1 deletion web/src/app/rotations/RotationUserList.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import RotationSetActiveDialog from './RotationSetActiveDialog'
import RotationUserDeleteDialog from './RotationUserDeleteDialog'
import { DateTime } from 'luxon'
import { UserAvatar } from '../util/avatar'
import { withStyles } from '@material-ui/core'
import { styles as globalStyles } from '../styles/materialStyles'

const rotationUsersQuery = gql`
query rotationUsers($id: ID!) {
Expand All @@ -36,6 +38,15 @@ const mutation = gql`
}
`

const styles = theme => {
const { cardHeader } = globalStyles(theme)

return {
cardHeader,
}
}

@withStyles(styles)
export default class RotationUserList extends React.PureComponent {
static propTypes = {
rotationID: p.string.isRequired,
Expand All @@ -47,10 +58,15 @@ export default class RotationUserList extends React.PureComponent {
}

render() {
const { classes } = this.props
return (
<React.Fragment>
<Card>
<CardHeader title='Users' />
<CardHeader
className={classes.cardHeader}
component='h3'
title='Users'
/>
<CardContent>
<Query
query={rotationUsersQuery}
Expand Down
18 changes: 17 additions & 1 deletion web/src/app/services/components/OnCallForService.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,18 @@ import Typography from '@material-ui/core/Typography'
import { UserAvatar } from '../../util/avatar'
import { Link } from 'react-router-dom'
import Spinner from '../../loading/components/Spinner'
import { withStyles } from '@material-ui/core'
import { styles as globalStyles } from '../../styles/materialStyles'

const styles = theme => {
const { cardHeader } = globalStyles(theme)

return {
cardHeader,
}
}

@withStyles(styles)
export default class OnCallForService extends Component {
static propTypes = {
onCallUsers: p.arrayOf(
Expand Down Expand Up @@ -94,10 +105,15 @@ export default class OnCallForService extends Component {

render() {
let content = this.props.loading ? <Spinner /> : this.renderUsers()
let { classes } = this.props

return (
<Card>
<CardHeader title='On Call Users' />
<CardHeader
className={classes.cardHeader}
component='h3'
title='On Call Users'
/>
<CardContent>{content}</CardContent>
</Card>
)
Expand Down
3 changes: 2 additions & 1 deletion web/src/app/styles/materialStyles.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const styles = theme => ({
// Used to reduce padding between header and content
cardHeader: {
paddingBottom: 0,
margin: 0,
},
asLink: {
color: 'blue',
Expand All @@ -26,7 +27,7 @@ export const styles = theme => ({
display: 'inline-block',
},
cancelButton: {
color: theme.palette.secondary['500'],
color: 'rgba(0,0,0, 0.54)',
},
defaultFlex: {
flex: '0 1 auto',
Expand Down
7 changes: 2 additions & 5 deletions web/src/app/templates/index.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
<!DOCTYPE html>
<html class="no-js" lang="">
<html class="no-js" lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>GoAlert</title>
<meta name="description" content="" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, user-scalable=no"
/>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="preconnect" href="https://gravatar.com" />
<link
rel="shortcut icon"
Expand Down
Loading

0 comments on commit 96a372c

Please sign in to comment.