Skip to content

Feature/accessibility improvements#2

Open
nlaffey wants to merge 14 commits into
masterfrom
feature/accessibility_improvements
Open

Feature/accessibility improvements#2
nlaffey wants to merge 14 commits into
masterfrom
feature/accessibility_improvements

Conversation

@nlaffey

@nlaffey nlaffey commented Dec 27, 2019

Copy link
Copy Markdown
Owner

Comment thread .gitignore
node_modules
css
node_modules-2018-11-27
.idea

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use intelliJ, this is to prevent my IDE files from being committed

Comment thread index.html
@@ -1,5 +1,5 @@
<!doctype html>
<html>
<html lang="en">

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding the lang helps non-human readers to identify what language is to be expected from this page.

https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang

Comment thread package.json
"watch": "watchify index.js -p livereactload -o bundle.js -dv",
"watchServer": "node-supervisor --watch server.js,src server.babel.js",
"serve": "PORT=1314 node server.babel.js",
"build-css": "sass ./sass/main.scss ./css/main.css",

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't see any build process for CSS. I've added these scripts and updated the documentation to call it out. Let me know if I overlooked the build process somewhere however.

Comment thread package.json
"watchify": "^3.9.0"
},
"dependencies": {
"sass": "^1.24.0",

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sass dependency for the css build scripts: https://github.com/nlaffey

Comment thread sass/reset.scss
@@ -1,4 +1,10 @@
/* reset & clearfix */
/* reset & clearfix

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per my comments here, I've removed the outline styles from the reset. This is something that I would want to run by a designer to see if its suitable for the site. It's important to keep in mind each browser will implement the focus style differently but this may be for the best. Users will be most familiar with their browsers focus style.

Comment thread server.js
app.use((req, res, next) => {
var actingUrl = req.url.replace(/\/(.*)\/$/, '/$1')
const internalIPs = process.env.PRIVILEGED_IP_LIST
const internalIPs = process.env.PRIVILEGED_IP_LIST || '';

@nlaffey nlaffey Dec 27, 2019

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than force users to provide the environment variable I thought it made sense to default to an empty string. If this is set to null then it throws a null pointer error below when we try to .split

Comment thread src/department.js
<Peek facet="department" q={deptName} quiltProps={{maxRowHeight: 400}} offset={10}/>
<Helmet title={deptName} />
<Departments compact={true} active={deptName} />
<main role="main" className="departmentPage" id="main">

@nlaffey nlaffey Dec 27, 2019

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By using the main element we help tell screenreaders/search engines where the primary content is. This can help consumers more quickly locate the unique content of this page rather than scaffolding around it (footer, navigation, etc).

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/main
https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles

Comment thread src/home.js

render() {
return <div className="landingPageBody">
return <main role="main" id="main" className="landingPageBody">

@nlaffey nlaffey Dec 27, 2019

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same concept as here: https://github.com/nlaffey/art/pull/2/files#r361749695

There's also likely other routes on the site that could use this same treatment.

Comment thread src/image-quilt.js
};

return <Link
onKeyDown={handleKeyDown}

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enter key presses were not registering as clicks. You could tab to the image but you weren't able to access it without using the mouse. This allows the enter key to be pressed.

Comment thread src/map.js
render() {
var {number, prevLink, nextLink, ...extraProps} = this.props
var thumbnail = <img
// TODO: Update to pass in an appropriate description of the image instead of just the number

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately there didn't seem to be a quick way to get the alt text here. Generally I feel that some alt text is better than nothing.

Comment thread src/search.js
const formProps = universal ? {action: "/search/", method: "get"} : {action: ''}
const simpleSearchBox = <div className='search-wrapper' style={{width: idealSearchBoxWidth + 'em'}}>
<form {...formProps}><input className='search-input' type="search"
<form {...formProps} role="search">

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding role of search here to help identify what this form is being used for

https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/Search_role

Comment thread src/search.js
<form {...formProps}><input className='search-input' type="search"
<form {...formProps} role="search">

<label htmlFor='search-input' className="visuallyhidden">Search</label>

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding a label for this input both using arial-label as well as a label that is visuallyhidden (this uses material-ui's class to marginLeft it off the screen)

@@ -0,0 +1,10 @@
var React = require('react');

var SkipToMainContentLink = React.createClass({

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created this class as I was originally going to put the skip to main content link in a few different places. Ultimately I only ended up using it one place but decided to leave it here in it's own class for better re-usability.

@nlaffey nlaffey Dec 27, 2019

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By adding the skip link it helps users quickly navigate over tedious navigation links so they can go straight to the main content of the page. The link is only visible when focused so only users with screen readers or tabbing through the page would reveal it:

image

https://webaim.org/techniques/skipnav/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant