Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

562 front accessibility panel #806

Merged
merged 18 commits into from
Sep 24, 2020
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions client/components/common/CONSTANTS.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,69 @@ export const CITY_COUNCILS = [
{ id: 15, name: 'Council District 15' },
];

export const ACCESSIBILITY_INSTRUCTIONS = [
{
instruction: 'Move backward from link to link or to controls: ',
shortcut: 'Shift + Tab',
},
{
instruction: 'Select buttons: ',
shortcut: 'Spacebar',
},
{
instruction: 'Navigate and select Radio Buttons: ',
shortcut: 'Arrow',
},
{
instruction: 'Select/deselect boxes: ',
shortcut: 'Spacebar',
},
{
instruction: 'Move from box to box: ',
shortcut: 'Tab',
},
{
instruction: 'Open a List Box: ',
shortcut: 'ALT + Down arrow',
},
{
instruction: 'Read the prior screen: ',
shortcut: 'CTRL + Page Up',
},
{
instruction: 'Read the next screen: ',
shortcut: 'CTRL + Page Down',
},
{
instruction: 'Go to the top of the page: ',
shortcut: 'CTRL + Home',
},
{
instruction: 'Go to the bottom of the page: ',
shortcut: 'CTRL + End',
},
{
instruction: 'Close the current window (in Internet Explorer): ',
shortcut: 'CTRL + W',
},
{
instruction: 'Refresh the screen: ',
shortcut: 'F5',
},
{
instruction: 'Go back a page: ',
shortcut: 'ALT + Left Arrow',
},
{
instruction: 'Go forward a page: ',
shortcut: 'ALT + Right Arrow',
},
{
instruction: 'Navigate to and select the text in the address combo box: ',
shortcut: 'ALT + D',
},
];

/*
NC regions and names are from here:
https://empowerla.org/councils-by-service-region/
Expand Down
2 changes: 1 addition & 1 deletion client/components/main/footer/StaticFooter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const StaticFooter = () => (
Powered by volunteers from 
<a
href="https://www.hackforla.org/#projects"
ariaLabel="hack for la website"
aria-label="hack for la website"
tan-nate marked this conversation as resolved.
Show resolved Hide resolved
className="has-text-weight-bold"
rel="external noopener noreferrer"
target="_blank"
Expand Down
73 changes: 73 additions & 0 deletions client/components/main/header/AccessibilityPane.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/* eslint-disable max-len */

import React, { useState } from 'react';
import classNames from 'classnames';
import { ACCESSIBILITY_INSTRUCTIONS } from '@components/common/CONSTANTS';

const AccessibilityPane = () => {
const [isOpen, updateIsOpen] = useState(false);
const dropdownClassName = classNames('dropdown', {
'is-active': isOpen,
});

const handleClick = () => {
updateIsOpen(!isOpen);
};

const renderInstructions = () => ACCESSIBILITY_INSTRUCTIONS.map((element, index) => {
if (index % 2 !== 0) {
return (
<div className="instruction" key={index.toString()}>
<p>
{element.instruction}
<b>{element.shortcut}</b>
</p>
</div>
);
}

return (
<div className="instruction offset" key={index.toString()}>
<p>
{element.instruction}
<b>{element.shortcut}</b>
</p>
</div>
);
});

return (
<div
className={dropdownClassName}
>
<div
className="dropdown-trigger"
onClick={handleClick}
style={{ width: '100%' }}
role="presentation"
>
<svg width="25" height="25" viewBox="0 0 25 25" fill="none" xmlns="http://www.w3.org/2000/svg" cursor="pointer">
<path d="M24.9661 12.4994C24.9661 5.64131 19.3918 0.0332031 12.4999 0.0332031C5.60802 0.0332031 0.0336914 5.64131 0.0336914 12.4994C0.0336914 19.3575 5.6418 24.9656 12.4999 24.9656C19.358 24.9656 24.9661 19.3575 24.9661 12.4994ZM12.4999 3.81699C13.5472 3.81699 14.3918 4.66158 14.3918 5.70888C14.3918 6.75618 13.5472 7.60077 12.4999 7.60077C11.4526 7.60077 10.608 6.75618 10.608 5.70888C10.608 4.69536 11.4526 3.81699 12.4999 3.81699ZM10.608 20.3373C10.4391 20.7089 10.1013 20.9116 9.72964 20.9116C9.5945 20.9116 9.45937 20.8778 9.32423 20.8102C8.81747 20.5737 8.61477 19.9994 8.85126 19.4927C8.85126 19.4927 10.7094 15.2359 11.0472 13.6819C11.1823 13.1413 11.2499 11.6886 11.2837 11.0129C11.2837 10.7764 11.1486 10.5737 10.9459 10.5062L6.75666 9.28996C6.21612 9.12104 5.91207 8.54672 6.08099 8.03996C6.24991 7.5332 6.82423 7.29672 7.33099 7.43185C7.33099 7.43185 11.1486 8.64807 12.4999 8.64807C13.8513 8.64807 17.7364 7.39807 17.7364 7.39807C18.2432 7.26293 18.8175 7.56699 18.9526 8.07374C19.0877 8.5805 18.7837 9.15482 18.2769 9.28996L14.1215 10.54C13.9188 10.6075 13.7499 10.8102 13.7837 11.0467C13.8175 11.7224 13.885 13.1751 14.0202 13.7156C14.358 15.2697 16.2161 19.5264 16.2161 19.5264C16.4526 20.0332 16.2161 20.6075 15.7432 20.844C15.608 20.9116 15.4729 20.9454 15.3377 20.9454C14.9661 20.9454 14.5945 20.7427 14.4594 20.371L12.4999 16.2832L10.608 20.3373Z" fill="white" />
</svg>
</div>
<div className="dropdown-menu" id="accessibility-dropdown" role="menu">
<div className="dropdown-content">
<div className="dropdown-content-item">
<h2>Accessibility Information</h2>
<h3>Map</h3>
<p>The map shows the Neighborhood Councils (NC) in Los Angeles. Each NC is outlined in a dotted line, and the border of each NC is outlined in a thick yellow line when hovering over it with your mouse.</p>
<h3>Data Visualization</h3>
<p>Data visualizations show the results once the filter criterias are selected and submitted. The charts display details once the mouse hovers over the charts.</p>
<h3>Keyboard Accessibility</h3>
<p>Use these common keyboard commands to navigate web pages without a mouse. Some keystrokes may not work with every Internet browser.</p>
</div>
<div className="dropdown-content-item key-instructions">
{renderInstructions()}
</div>
</div>
</div>
</div>
);
};

export default AccessibilityPane;
5 changes: 5 additions & 0 deletions client/components/main/header/Header.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useState } from 'react';
import { Link, NavLink } from 'react-router-dom';
import clx from 'classnames';
import AccessibilityPane from './AccessibilityPane';
import COLORS from '../../../styles/COLORS';

const Header = () => {
Expand All @@ -27,6 +28,7 @@ const Header = () => {
className="navbar"
role="navigation"
aria-label="main navigation"
id="top-navbar"
>
<div className="navbar-brand">
<Link to="/" className="navbar-item">
Expand Down Expand Up @@ -77,6 +79,9 @@ const Header = () => {
Contact Us
</NavLink>
</div>
<div className="navbar-item">
<AccessibilityPane />
</div>
</div>
</div>
</nav>
Expand Down
2 changes: 2 additions & 0 deletions client/styles/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ $brand-cta1-color: #FFB24A; // orange
$brand-cta2-color: #55D4D2; // light blue
$brand-bg-color: #FFFFFF; // white
$brand-stroke-color: #999999; // grey
$brand-stroke-color-light: #EEEEEE; // light grey

// font families
$brand-heading-family: 'Open Sans', sans-serif;
Expand Down Expand Up @@ -46,3 +47,4 @@ $z-modal: 10000;

// header and footer
$z-navbar: 20000;
$z-top-navbar: 30000;
59 changes: 57 additions & 2 deletions client/styles/main/_header.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.navbar {
$hamburger-height: 200px;

font-family: $brand-heading-family;
font-weight: bold;
height: $header-height;
Expand Down Expand Up @@ -38,12 +40,13 @@
}
}

@media only screen and (max-width: 1024px) {
@media only screen and (max-width: 1022px) {
.navbar-menu.is-active {
padding: 0;
background: none;
box-shadow: none;
width: 270px;
height: $hamburger-height;
position: fixed;
right: 0;

Expand All @@ -55,7 +58,7 @@
}

.navbar-menu .navbar-item {
font-size: 16px;
font-size: 15px;
margin-right: 20px;
}

Expand Down Expand Up @@ -87,4 +90,56 @@
}
}
}

div#accessibility-dropdown {
right: -25px;
top: 50px;
left: auto;
width: 600px;
height: calc(100vh - #{$header-height + $footer-height + 5px});
overflow-y: scroll;
padding: 0;
border-radius: 5px;

@media only screen and (max-width: 1022px) {
right: auto;
left: -350px;
top: 45px;
height: calc(100vh - #{$header-height + $hamburger-height});
}
}

div.dropdown-content {
background-color: $brand-stroke-color-light;
}

div.dropdown-content-item {
margin: 5px 15px;

h3 {
margin-top: 12px;
}

p {
font-family: $brand-text-family;
font-weight: lighter;
font-size: 0.9em;
}
}

div.dropdown-content-item.key-instructions {
margin: 10px 0 0 0;
}

.instruction {
padding: 2px 0 2px 15px;
}

.offset {
background-color: rgb(226, 226, 226);
}
}

nav#top-navbar {
z-index: $z-top-navbar;
}
25 changes: 20 additions & 5 deletions client/styles/main/_staticfooter.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,29 @@
font-family: $brand-text-family;
font-size: 14px;
font-weight: normal;
margin-left: 40px;
margin-right: 40px;
margin: 15px 0 0 20px;
position: absolute;

a {
color: $brand-bg-color;
}
}
.social-media-links {
margin: 5px 20px 0 0;
position: absolute;
right: 0;
@media only screen and (max-width: 710px) {
display: none;
}

a {
display: table-cell;
vertical-align: middle;
line-height: $footer-height;
height: $footer-height;
}

&.level-left {
flex: 1;
.icon {
margin: 0 3px;
}
}
}
4 changes: 2 additions & 2 deletions e2e/cypress/integration/e2e_tests.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('311 Data', () => {
cy.get('.dropdown-trigger > .button').click()
cy.get('[value="LAST_WEEK"]').click()
cy.get(':nth-child(2) > .select-group-content > .select-item > .select-item-box').click()
cy.get('#type-selector-container > div.columns.is-0 > div:nth-child(1) > div:nth-child(2) > span > input').click({force: true})
cy.get('#type-selector-container > div.columns.is-gapless > div:nth-child(1) > div:nth-child(2) > span > input').click({force: true})
cy.get('#btn-sidebar-submit-button').click()

cy.wait('@getFilterList').should((xhr) => {
Expand Down Expand Up @@ -58,7 +58,7 @@ describe('311 Data', () => {
cy.get('.dropdown-trigger > .button').click()
cy.get('[value="LAST_WEEK"]').click()
cy.get(':nth-child(2) > .select-group-content > .select-item > .select-item-box').click()
cy.get('#type-selector-container > div.columns.is-0 > div:nth-child(1) > div:nth-child(2) > span > input').click({force: true})
cy.get('#type-selector-container > div.columns.is-gapless > div:nth-child(1) > div:nth-child(2) > span > input').click({force: true})
cy.get('#btn-sidebar-submit-button').click()

cy.wait('@getFilterList').should((xhr) => {
Expand Down