Skip to content

Commit

Permalink
Add accessibility
Browse files Browse the repository at this point in the history
Add correct focus state for buttons and links
  • Loading branch information
sergey-pimenov committed Jan 2, 2018
1 parent e2153a8 commit cb1028e
Show file tree
Hide file tree
Showing 10 changed files with 235 additions and 13 deletions.
2 changes: 1 addition & 1 deletion assets/scripts/index.js

Large diffs are not rendered by default.

100 changes: 94 additions & 6 deletions assets/styles/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,23 @@ body.showDoc::after {
.goTop.show {
-webkit-transform: translateX(0);
transform: translateX(0); }
@media (min-width: 1151px) {
.goTop:focus::after {
content: '';
width: calc(100% - 4px);
height: calc(100% - 4px);
position: absolute;
left: 0;
top: 0;
border: 2px black dashed; } }

button {
button,
a,
span {
outline: none; }
button::-moz-focus-inner {
button::-moz-focus-inner,
a::-moz-focus-inner,
span::-moz-focus-inner {
border: 0; }

header {
Expand Down Expand Up @@ -300,6 +313,21 @@ header {
left: 0;
-webkit-transform-origin: 0 50%;
transform-origin: 0 50%; }
.titleAndNav nav a.toolsNav::before {
content: '';
width: 90%;
height: 130%;
display: block;
position: absolute;
right: -3.5%;
top: -20%;
border: 2px black dashed;
z-index: -1;
opacity: 0;
-webkit-transition: opacity 0.5s;
transition: opacity 0.5s; }
.titleAndNav nav a.toolsNav:focus::before {
opacity: 1; }
@media (max-width: 1150px) {
.titleAndNav nav a.toolsNav {
padding: 0; } }
Expand All @@ -308,6 +336,21 @@ header {
right: 0;
-webkit-transform-origin: 100% 50%;
transform-origin: 100% 50%; }
.titleAndNav nav a.materialsNav::before {
content: '';
width: 85%;
height: 130%;
display: block;
position: absolute;
left: -5%;
top: -20%;
border: 2px black dashed;
z-index: -1;
-webkit-transition: opacity 0.5s;
transition: opacity 0.5s;
opacity: 0; }
.titleAndNav nav a.materialsNav:focus::before {
opacity: 1; }
@media (max-width: 1150px) {
.titleAndNav nav a.materialsNav {
padding: 0; } }
Expand Down Expand Up @@ -540,6 +583,18 @@ footer {
font-family: 'Roboto', sans-serif;
font-weight: 700;
color: black; }
footer a {
display: inline-block;
-webkit-transform-origin: 0 50%;
transform-origin: 0 50%;
-webkit-transition: -webkit-transform 0.2s;
transition: -webkit-transform 0.2s;
transition: transform 0.2s;
transition: transform 0.2s, -webkit-transform 0.2s; }
@media (min-width: 1151px) {
footer a:focus {
text-transform: uppercase;
text-decoration: underline; } }
footer img {
height: 1em;
display: inline-block;
Expand Down Expand Up @@ -605,6 +660,11 @@ footer {
opacity: 0;
-webkit-transition: all 0.15s;
transition: all 0.15s; }
@media (min-width: 1151px) {
.tools .tool a:focus {
opacity: 1;
-webkit-transform: scale(1.1);
transform: scale(1.1); } }
@media (min-width: 1151px) {
.tools .tool:hover a {
opacity: 1; } }
Expand Down Expand Up @@ -796,7 +856,16 @@ footer {
font-size: 16px;
color: white;
font-family: 'Roboto', sans-serif;
border-radius: 0; }
border-radius: 0;
-webkit-transition: -webkit-transform 0.2s;
transition: -webkit-transform 0.2s;
transition: transform 0.2s;
transition: transform 0.2s, -webkit-transform 0.2s; }
.options button:focus {
background-color: white;
color: black;
-webkit-transform: scale(1.1);
transform: scale(1.1); }
@media (max-width: 900px) {
.options button {
width: 100%;
Expand Down Expand Up @@ -1110,10 +1179,20 @@ footer {
align-items: center;
position: relative;
font-size: 16px;
cursor: pointer; }
cursor: pointer;
-webkit-transition: -webkit-transform 0.2s;
transition: -webkit-transform 0.2s;
transition: transform 0.2s;
transition: transform 0.2s, -webkit-transform 0.2s; }
.bestMaterials .categories .category:hover {
background-color: white;
color: black; }
@media (min-width: 1151px) {
.bestMaterials .categories .category:focus {
background-color: white;
color: black;
-webkit-transform: scale(1.1);
transform: scale(1.1); } }
.bestMaterials .categories .category.selected {
background-color: white;
color: black; }
Expand Down Expand Up @@ -1273,9 +1352,13 @@ footer {
.bestMaterials article a {
width: 100%;
height: 100%;
display: block;
position: absolute;
left: 0;
top: 0; }
@media (min-width: 1151px) {
.bestMaterials article a:focus {
background: rgba(150, 150, 150, 0.1); } }
.bestMaterials .title {
height: 38px;
margin-bottom: 30px;
Expand Down Expand Up @@ -1397,10 +1480,15 @@ footer {
position: absolute;
right: 30px;
bottom: 20px;
-webkit-transition: background-color 0.15s;
transition: background-color 0.15s; }
-webkit-transition: all 0.15s;
transition: all 0.15s; }
.bestMaterials .books .link:hover {
background-color: black; }
@media (min-width: 1151px) {
.bestMaterials .books .link:focus {
opacity: 1;
-webkit-transform: scale(1.1);
transform: scale(1.1); } }
@media (max-width: 900px) {
.bestMaterials .books .link {
width: 100%;
Expand Down
20 changes: 19 additions & 1 deletion src/basic/styles/basic.sass
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,25 @@ body.showDoc::after
&.show
transform: translateX(0)

button
+bp(xl)
&:focus::after
content: ''
width: calc(100% - 4px)
height: calc(100% - 4px)
position: absolute
left: 0
top: 0
border: 2px black dashed


// @keyframes blink
// 100%
// background-color: rgb(235, 235, 255)
button,
a,
span
outline: none

&::-moz-focus-inner
border: 0
10 changes: 10 additions & 0 deletions src/basic/styles/footer.sass
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ footer
font-weight: 700
color: black

a
display: inline-block
transform-origin: 0 50%
transition: transform 0.2s

+bp(xl)
a:focus
text-transform: uppercase
text-decoration: underline

img
height: 1em
display: inline-block
Expand Down
32 changes: 32 additions & 0 deletions src/basic/styles/header.sass
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,22 @@ header
left: 0
transform-origin: 0 50%
&::before
content: ''
width: 90%
height: 130%
display: block
position: absolute
right: -3.5%
top: -20%
border: 2px black dashed
z-index: -1
opacity: 0
transition: opacity 0.5s
&:focus::before
opacity: 1
+bp(lg)
padding: 0
Expand All @@ -98,6 +114,22 @@ header
right: 0
transform-origin: 100% 50%
&::before
content: ''
width: 85%
height: 130%
display: block
position: absolute
left: -5%
top: -20%
border: 2px black dashed
z-index: -1
transition: opacity 0.5s
opacity: 0
&:focus::before
opacity: 1
+bp(lg)
padding: 0
Expand Down
18 changes: 16 additions & 2 deletions src/components/bestMaterials/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export default function() {
Scroll to
<img width="15px" height="auto" src="assets/images/goTo.svg">
</h3>
<span class="category" id="books"> Books </span>
<span class="category" id="articlesAndVideos"> Articles and videos </span>
<span class="category" id="books" tabindex="0"> Books </span>
<span class="category" id="articlesAndVideos" tabindex="0"> Articles and videos </span>
</div>
</div>
Expand Down Expand Up @@ -52,6 +52,20 @@ export default function() {
});

})

category[i].addEventListener('keydown', function(e) {
if(e.keyCode != 13) return;

var scroll = new SmoothScroll();

var selectedItem = e.target.id;

var anchor = document.querySelector('#' + selectedItem + 'Title');
scroll.animateScroll(anchor, category[i], {
offset : 65
});

})
}

var showCategories = document.getElementsByClassName('showCategories')[0];
Expand Down
19 changes: 18 additions & 1 deletion src/components/bestMaterials/index.sass
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,18 @@
position: relative
font-size: 16px
cursor: pointer
transition: transform 0.2s

&:hover
background-color: white
color: black

+bp(xl)
&:focus
background-color: white
color: black
transform: scale(1.1)

&.selected
background-color: white
color: black
Expand Down Expand Up @@ -263,10 +270,15 @@
a
width: 100%
height: 100%
display: block
position: absolute
left: 0
top: 0

+bp(xl)
&:focus
background: rgba(150, 150, 150, 0.1)

.title
height: 38px
margin-bottom: 30px
Expand Down Expand Up @@ -384,11 +396,16 @@
position: absolute
right: 30px
bottom: 20px
transition: background-color 0.15s
transition: all 0.15s

&:hover
background-color: black

+bp(xl)
&:focus
opacity: 1
transform: scale(1.1)

+bp(md)
width: 100%
padding: 10px 20px
Expand Down
1 change: 1 addition & 0 deletions src/components/tools/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export default function() {
var toolsCount = toolsData.length;
function createTool(toolName, toolLogo, toolTechnologies, toolSize, toolLink) {
var tool = document.createElement('div');
tool.setAttribute('tabindex', '-1');
tool.classList.add('tool');

var link = document.createElement('a');
Expand Down
11 changes: 11 additions & 0 deletions src/components/tools/index.sass
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@
opacity: 0
transition: all 0.15s

+bp(xl)
&:focus
opacity: 1
transform: scale(1.1)

+bp(xl)
&:hover a
opacity: 1
Expand Down Expand Up @@ -208,6 +213,12 @@
color: white
font-family: 'Roboto', sans-serif
border-radius: 0 // For mobile FF
transition: transform 0.2s

&:focus
background-color: white
color: black
transform: scale(1.1)

+bp(md)
width: 100%
Expand Down
Loading

0 comments on commit cb1028e

Please sign in to comment.