Skip to content

Commit f61e5b5

Browse files
Merge pull request #210 from opentripplanner/commtrans-accessibility
improvement(a11y): Add markup and props for Lighthouse scorecard.
2 parents a6b1710 + 4b258e5 commit f61e5b5

File tree

6 files changed

+42
-15
lines changed

6 files changed

+42
-15
lines changed

Diff for: example.js

+13-7
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,10 @@ class OtpRRExample extends Component {
8585
<Grid>
8686
<Row className='main-row'>
8787
<Col sm={6} md={4} className='sidebar'>
88-
<DefaultMainPanel LegIcon={MyLegIcon} ModeIcon={MyModeIcon} />
88+
{/* <main> Needed for accessibility checks. TODO: Find a better place. */}
89+
<main>
90+
<DefaultMainPanel LegIcon={MyLegIcon} ModeIcon={MyModeIcon} />
91+
</main>
8992
</Col>
9093
<Col sm={6} md={8} className='map-container'>
9194
<Map />
@@ -97,12 +100,15 @@ class OtpRRExample extends Component {
97100

98101
/** mobile view **/
99102
const mobileView = (
100-
<MobileMain
101-
LegIcon={MyLegIcon}
102-
ModeIcon={MyModeIcon}
103-
map={<Map />}
104-
title={<div className='navbar-title'>OpenTripPlanner</div>}
105-
/>
103+
// <main> Needed for accessibility checks. TODO: Find a better place.
104+
<main>
105+
<MobileMain
106+
LegIcon={MyLegIcon}
107+
ModeIcon={MyModeIcon}
108+
map={<Map />}
109+
title={<div className='navbar-title'>OpenTripPlanner</div>}
110+
/>
111+
</main>
106112
)
107113

108114
/** the main webapp **/

Diff for: lib/components/app/app-menu.js

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class AppMenu extends Component {
3333
return (
3434
<div className='app-menu'>
3535
<DropdownButton
36+
aria-label='Application Menu'
3637
title={(<Icon type='bars' />)}
3738
noCaret
3839
className='app-menu-button'

Diff for: lib/components/form/date-time-preview.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@ class DateTimePreview extends Component {
6565

6666
const button = (
6767
<div className='button-container'>
68-
<Button onClick={this.props.onClick}>
68+
<Button
69+
aria-label='Edit departure or arrival time'
70+
onClick={this.props.onClick}
71+
>
6972
{editButtonText}{caret && <span> <i className={`fa fa-caret-${caret}`} /></span>}
7073
</Button>
7174
</div>

Diff for: lib/components/form/settings-preview.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ class SettingsPreview extends Component {
3535
let showDot = coreUtils.query.isNotDefaultQuery(query, config)
3636
const button = (
3737
<div className='button-container'>
38-
<Button onClick={this.props.onClick}>
38+
<Button
39+
aria-label={messages.label.replace('\n', ' ')}
40+
onClick={this.props.onClick}
41+
>
3942
{editButtonText}{caret && <span> <i className={`fa fa-caret-${caret}`} /></span>}
4043
</Button>
4144
{showDot && <div className='dot' />}

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"@opentripplanner/humanize-distance": "^0.0.22",
3636
"@opentripplanner/icons": "^1.0.1",
3737
"@opentripplanner/itinerary-body": "^1.0.2",
38-
"@opentripplanner/location-field": "^1.0.1",
38+
"@opentripplanner/location-field": "^1.0.2",
3939
"@opentripplanner/location-icon": "^1.0.0",
4040
"@opentripplanner/park-and-ride-overlay": "^1.0.1",
4141
"@opentripplanner/printable-itinerary": "^1.0.0",

Diff for: yarn.lock

+19-5
Original file line numberDiff line numberDiff line change
@@ -1275,6 +1275,20 @@
12751275
prop-types "^15.7.2"
12761276
qs "^6.9.1"
12771277

1278+
"@opentripplanner/core-utils@^2.1.0":
1279+
version "2.1.0"
1280+
resolved "https://registry.yarnpkg.com/@opentripplanner/core-utils/-/core-utils-2.1.0.tgz#ab7271a2b560168b21b0dd26c78532f24fd031f5"
1281+
integrity sha512-sQ3oiZB7f01kCVuTj5SzqsPe4uchupNbla+onLWH+aO3wH+OLZNuLRZZ/7oFFFnvpcFBakyg4TePPxyyEyJlMA==
1282+
dependencies:
1283+
"@mapbox/polyline" "^1.1.0"
1284+
"@turf/along" "^6.0.1"
1285+
bowser "^2.7.0"
1286+
lodash.isequal "^4.5.0"
1287+
moment "^2.24.0"
1288+
moment-timezone "^0.5.27"
1289+
prop-types "^15.7.2"
1290+
qs "^6.9.1"
1291+
12781292
"@opentripplanner/endpoints-overlay@^1.0.1":
12791293
version "1.0.1"
12801294
resolved "https://registry.yarnpkg.com/@opentripplanner/endpoints-overlay/-/endpoints-overlay-1.0.1.tgz#d95f0bbfddc9382b593845799b963340eece2742"
@@ -1332,12 +1346,12 @@
13321346
react-resize-detector "^4.2.1"
13331347
velocity-react "^1.4.3"
13341348

1335-
"@opentripplanner/location-field@^1.0.1":
1336-
version "1.0.1"
1337-
resolved "https://registry.yarnpkg.com/@opentripplanner/location-field/-/location-field-1.0.1.tgz#9db5622208739db06d707bfb5b443291598d803e"
1338-
integrity sha512-V2i1BDQPzQ8OJ1F1JQkH++LNLQzHR3w0nGvIwY31iTEdukDeePSa5raSPFwAXy90uqNtk2Xt6NPRetMII1L//w==
1349+
"@opentripplanner/location-field@^1.0.2":
1350+
version "1.0.2"
1351+
resolved "https://registry.yarnpkg.com/@opentripplanner/location-field/-/location-field-1.0.2.tgz#16daeac83be8f10b157fc8c51f32e2a8eb0a8db8"
1352+
integrity sha512-+YIXXltw6ZuHyvCzbDL97Wfhq+C/FaT2utmWAf1O1g6BGpkF6dHjh8+ZHoH0al/4/t6AyhSVlPMXOEyaj2xERA==
13391353
dependencies:
1340-
"@opentripplanner/core-utils" "^1.2.0"
1354+
"@opentripplanner/core-utils" "^2.1.0"
13411355
"@opentripplanner/geocoder" "^1.0.2"
13421356
"@opentripplanner/humanize-distance" "^0.0.22"
13431357
"@opentripplanner/location-icon" "^1.0.0"

0 commit comments

Comments
 (0)