├── 05_04 ├── style.css └── index.html ├── .gitignore ├── .github ├── CODEOWNERS ├── PULL_REQUEST_TEMPLATE.md └── ISSUE_TEMPLATE.md ├── 06_03 ├── images │ ├── cal.png │ ├── mega.png │ └── phones.png ├── style.css └── index.html ├── 06_04 ├── images │ ├── cal.png │ ├── mega.png │ └── phones.png ├── style.css └── index.html ├── 03_02 ├── style.css └── index.html ├── 06_05 ├── style.css ├── index.html └── script.js ├── 05_06 ├── script.js ├── style.css └── index.html ├── 04_05 ├── index.html └── style.css ├── CONTRIBUTING.md ├── NOTICE ├── 04_07 ├── index.html └── style.css ├── 05_05 ├── style.css └── index.html ├── 06_01 ├── script.js ├── index.html └── style.css ├── README.md ├── 06_02 ├── index.html ├── style.css └── script.js └── LICENSE /05_04/style.css: -------------------------------------------------------------------------------- 1 | .monster { 2 | height: 75vh; 3 | } 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | .tmp 4 | npm-debug.log 5 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Codeowners for these exercise files: 2 | # * (asterisk) deotes "all files and folders" 3 | # Example: * @producer @instructor 4 | -------------------------------------------------------------------------------- /06_03/images/cal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinkedInLearning/simplifying-web-development-with-accessibility-best-practices-2883015/HEAD/06_03/images/cal.png -------------------------------------------------------------------------------- /06_04/images/cal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinkedInLearning/simplifying-web-development-with-accessibility-best-practices-2883015/HEAD/06_04/images/cal.png -------------------------------------------------------------------------------- /06_03/images/mega.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinkedInLearning/simplifying-web-development-with-accessibility-best-practices-2883015/HEAD/06_03/images/mega.png -------------------------------------------------------------------------------- /06_03/images/phones.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinkedInLearning/simplifying-web-development-with-accessibility-best-practices-2883015/HEAD/06_03/images/phones.png -------------------------------------------------------------------------------- /06_04/images/mega.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinkedInLearning/simplifying-web-development-with-accessibility-best-practices-2883015/HEAD/06_04/images/mega.png -------------------------------------------------------------------------------- /06_04/images/phones.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinkedInLearning/simplifying-web-development-with-accessibility-best-practices-2883015/HEAD/06_04/images/phones.png -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /03_02/style.css: -------------------------------------------------------------------------------- 1 | .sr-only { 2 | clip: rect(1px, 1px, 1px, 1px); 3 | clip-path: inset(50%); 4 | height: 1px; 5 | width: 1px; 6 | margin: -1px; 7 | overflow: hidden; 8 | padding: 0; 9 | position: absolute; 10 | } 11 | -------------------------------------------------------------------------------- /06_05/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, 3 | Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif; 4 | font-size: 20px; 5 | } 6 | 7 | main { 8 | display: flex; 9 | flex-direction: column; 10 | align-items: center; 11 | } 12 | 13 | .pickers { 14 | max-width: 50ch; 15 | display: flex; 16 | gap: 2rem; 17 | } 18 | -------------------------------------------------------------------------------- /05_06/script.js: -------------------------------------------------------------------------------- 1 | const transcript = document.querySelector("#collapser"); 2 | transcript.classList.add("collapse"); 3 | const transcriptBtn = document.querySelector("#transcript-toggle"); 4 | 5 | transcriptBtn.addEventListener("click", () => { 6 | transcript.classList.contains("collapse") 7 | ? (transcriptBtn.innerHTML = "Collapse transcript") 8 | : (transcriptBtn.innerHTML = "Expand transcript"); 9 | transcript.classList.toggle("collapse"); 10 | }); 11 | -------------------------------------------------------------------------------- /04_05/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Button reset example 9 | 10 | 11 |

A button with CSS reset applied

12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /04_05/style.css: -------------------------------------------------------------------------------- 1 | button { 2 | font-family: inherit; 3 | font-size: 100%; 4 | line-height: 1.15; 5 | margin: 0; 6 | overflow: visible; 7 | text-transform: none; 8 | -webkit-appearance: button; 9 | border: 0; 10 | background: none; 11 | } 12 | 13 | button:hover { 14 | /* Mouse behavior like link */ 15 | cursor: pointer; 16 | } 17 | 18 | button:hover, 19 | button:focus, 20 | button:active { 21 | background: none; 22 | border-color: inherit; 23 | border-radius: 0; 24 | } 25 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | 2 | Contribution Agreement 3 | ====================== 4 | 5 | This repository does not accept pull requests (PRs). All pull requests will be closed. 6 | 7 | However, if any contributions (through pull requests, issues, feedback or otherwise) are provided, as a contributor, you represent that the code you submit is your original work or that of your employer (in which case you represent you have the right to bind your employer). By submitting code (or otherwise providing feedback), you (and, if applicable, your employer) are licensing the submitted code (and/or feedback) to LinkedIn and the open source community subject to the BSD 2-Clause license. 8 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Copyright 2021 LinkedIn Corporation 2 | All Rights Reserved. 3 | 4 | Licensed under the LinkedIn Learning Exercise File License (the "License"). 5 | See LICENSE in the project root for license information. 6 | 7 | Please note, this project may automatically load third party code from external 8 | repositories (for example, NPM modules, Composer packages, or other dependencies). 9 | If so, such third party code may be subject to other license terms than as set 10 | forth above. In addition, such third party code may also depend on and load 11 | multiple tiers of dependencies. Please review the applicable licenses of the 12 | additional dependencies. 13 | -------------------------------------------------------------------------------- /03_02/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Screen reader only text example. 9 | 10 | 11 |

Screen Reader Text

12 |

13 | This text is visible and available for both visual browsers and screen 14 | readers. 15 |

16 |

17 | This text is not visible in visual browsers, but will be read out by 18 | screen readers. 19 |

20 | 21 | 22 | -------------------------------------------------------------------------------- /06_05/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Date pickers 10 | 11 | 12 |
13 |

Pick some dates!

14 |
15 |
16 | 17 | 18 |
19 |
20 | 21 | 22 |
23 |
24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /06_05/script.js: -------------------------------------------------------------------------------- 1 | const startDateControl = document.querySelector('input[id="start"]'); 2 | const endDateControl = document.querySelector('input[id="end"]'); 3 | 4 | // Find the next date based on date. 5 | function nextDay(current) { 6 | let date = new Date(current); 7 | date = new Date(date.setDate(date.getDate() + 1)); 8 | return date; 9 | } 10 | 11 | // Set fields to today and tomorrow to start. 12 | const today = new Date(); 13 | const tomorrow = nextDay(today); 14 | startDateControl.value = today.toISOString().split("T")[0]; 15 | startDateControl.setAttribute("min", today.toISOString().split("T")[0]); 16 | endDateControl.value = tomorrow.toISOString().split("T")[0]; 17 | endDateControl.setAttribute("min", tomorrow.toISOString().split("T")[0]); 18 | 19 | // Update end date field when start date is set. 20 | startDateControl.addEventListener("change", (e) => { 21 | const startDate = new Date(startDateControl.value); 22 | const nextAvailableDate = nextDay(startDate); 23 | endDateControl.value = nextAvailableDate.toISOString().split("T")[0]; 24 | endDateControl.setAttribute( 25 | "min", 26 | nextAvailableDate.toISOString().split("T")[0] 27 | ); 28 | }); 29 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 7 | 8 | ## Issue Overview 9 | 10 | 11 | ## Describe your environment 12 | 13 | 14 | ## Steps to Reproduce 15 | 16 | 1. 17 | 2. 18 | 3. 19 | 4. 20 | 21 | ## Expected Behavior 22 | 23 | 24 | ## Current Behavior 25 | 26 | 27 | ## Possible Solution 28 | 29 | 30 | ## Screenshots / Video 31 | 32 | 33 | ## Related Issues 34 | 35 | -------------------------------------------------------------------------------- /04_07/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Accessible icon button 9 | 10 | 11 |

An accessible icon button with SVG icon.

12 |

13 | Screen readers read this button out as "Print pickled cheese recipes 14 | button." 15 |

16 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /06_03/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, 3 | Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif; 4 | font-size: 20px; 5 | } 6 | 7 | img { 8 | width: 100%; 9 | height: auto; 10 | } 11 | 12 | .sr-only { 13 | clip: rect(1px, 1px, 1px, 1px); 14 | clip-path: inset(50%); 15 | height: 1px; 16 | width: 1px; 17 | margin: -1px; 18 | overflow: hidden; 19 | padding: 0; 20 | position: absolute; 21 | } 22 | 23 | .card-list { 24 | margin: 2rem; 25 | padding: 0; 26 | display: flex; 27 | justify-content: space-between; 28 | list-style-type: none; 29 | gap: 2rem; 30 | } 31 | 32 | .card { 33 | position: relative; 34 | width: calc(100% / 3); 35 | border: 3px solid black; 36 | border-radius: 1rem; 37 | padding: 1rem; 38 | } 39 | 40 | .card a { 41 | color: black; 42 | text-decoration: none; 43 | } 44 | 45 | .card a:hover h2 { 46 | text-decoration: underline; 47 | } 48 | 49 | .link .card:hover a { 50 | text-decoration: underline; 51 | } 52 | 53 | /* Make the whole card clickable. */ 54 | /* Prevents text highlighting. */ 55 | .card a::after { 56 | position: absolute; 57 | top: 0; 58 | left: 0; 59 | content: ""; 60 | display: block; 61 | width: 100%; 62 | height: 100%; 63 | } 64 | -------------------------------------------------------------------------------- /05_05/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, 3 | Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif; 4 | font-size: 20px; 5 | } 6 | 7 | img { 8 | width: 100%; 9 | height: auto; 10 | } 11 | 12 | .sr-only { 13 | clip: rect(1px, 1px, 1px, 1px); 14 | clip-path: inset(50%); 15 | height: 1px; 16 | width: 1px; 17 | margin: -1px; 18 | overflow: hidden; 19 | padding: 0; 20 | position: absolute; 21 | } 22 | 23 | .card-list { 24 | margin: 2rem; 25 | padding: 0; 26 | display: flex; 27 | justify-content: space-between; 28 | list-style-type: none; 29 | gap: 2rem; 30 | } 31 | 32 | .card { 33 | position: relative; 34 | width: calc(100% / 3); 35 | border: 3px solid black; 36 | border-radius: 1rem; 37 | padding: 1rem; 38 | } 39 | 40 | .card:hover a { 41 | text-decoration: underline; 42 | } 43 | 44 | .card a { 45 | color: black; 46 | text-decoration: none; 47 | } 48 | 49 | .eyebrow { 50 | margin: 0.5rem 0; 51 | padding: 0; 52 | list-style-type: none; 53 | display: flex; 54 | gap: 0.8rem; 55 | } 56 | 57 | .eyebrow a { 58 | text-decoration: underline; 59 | text-transform: uppercase; 60 | font-size: 70%; 61 | } 62 | 63 | .readmore { 64 | text-decoration: underline; 65 | text-align: end; 66 | } 67 | -------------------------------------------------------------------------------- /06_04/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, 3 | Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif; 4 | font-size: 20px; 5 | } 6 | 7 | img { 8 | width: 100%; 9 | height: auto; 10 | } 11 | 12 | .sr-only { 13 | clip: rect(1px, 1px, 1px, 1px); 14 | clip-path: inset(50%); 15 | height: 1px; 16 | width: 1px; 17 | margin: -1px; 18 | overflow: hidden; 19 | padding: 0; 20 | position: absolute; 21 | } 22 | 23 | .card-list { 24 | margin: 2rem; 25 | padding: 0; 26 | display: flex; 27 | justify-content: space-between; 28 | list-style-type: none; 29 | gap: 2rem; 30 | } 31 | 32 | .card { 33 | position: relative; 34 | width: calc(100% / 3); 35 | border: 3px solid black; 36 | border-radius: 1rem; 37 | padding: 1rem; 38 | } 39 | 40 | .card:hover a { 41 | text-decoration: underline; 42 | } 43 | 44 | .card a { 45 | color: black; 46 | text-decoration: none; 47 | } 48 | 49 | .eyebrow { 50 | margin: 0.5rem 0; 51 | padding: 0; 52 | list-style-type: none; 53 | display: flex; 54 | gap: 0.8rem; 55 | } 56 | 57 | .eyebrow a { 58 | text-decoration: underline; 59 | text-transform: uppercase; 60 | font-size: 70%; 61 | } 62 | 63 | .readmore { 64 | text-decoration: underline; 65 | text-align: end; 66 | } 67 | -------------------------------------------------------------------------------- /05_05/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Improved accessible video embed 9 | 10 | 11 |
12 | 30 |
31 | 32 | 33 | -------------------------------------------------------------------------------- /06_01/script.js: -------------------------------------------------------------------------------- 1 | const nav = document.querySelector(".main-nav"); 2 | const trigger = document.querySelector(".menu-trigger"); 3 | const menu = document.querySelector(".main-nav ul"); 4 | 5 | // Hide menu on open. 6 | menu.classList.add("hide"); 7 | 8 | // Toggle menu open/closed. 9 | const toggleMenu = (status) => { 10 | if (status == "false") { 11 | menu.classList.remove("hide"); 12 | trigger.setAttribute("aria-expanded", "true"); 13 | trigger.setAttribute("aria-label", "Close news menu."); 14 | } else { 15 | menu.classList.add("hide"); 16 | trigger.setAttribute("aria-expanded", "false"); 17 | trigger.setAttribute("aria-label", "Open news menu."); 18 | } 19 | }; 20 | 21 | // Set initial state for the button. 22 | trigger.setAttribute("aria-expanded", "false"); 23 | trigger.setAttribute("aria-label", "Open news menu."); 24 | 25 | // Listen for button click 26 | trigger.addEventListener("click", function () { 27 | const status = trigger.getAttribute("aria-expanded"); 28 | toggleMenu(status); 29 | }); 30 | 31 | // Close menu when user tabs outside the menu. 32 | document.addEventListener("focusin", (e) => { 33 | if (e.target.closest("nav") !== nav) { 34 | toggleMenu(true); 35 | } 36 | }); 37 | 38 | // Close menu when user clicks outside the menu. 39 | document.addEventListener("click", (e) => { 40 | if (e.target.closest("nav") !== nav) { 41 | toggleMenu(true); 42 | } 43 | }); 44 | -------------------------------------------------------------------------------- /05_06/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, 3 | Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif; 4 | font-size: 20px; 5 | } 6 | 7 | .sr-only { 8 | clip: rect(1px, 1px, 1px, 1px); 9 | clip-path: inset(50%); 10 | height: 1px; 11 | width: 1px; 12 | margin: -1px; 13 | overflow: hidden; 14 | padding: 0; 15 | position: absolute; 16 | } 17 | 18 | main { 19 | margin: 2rem auto; 20 | padding: 0 2rem; 21 | max-width: 70ch; 22 | } 23 | 24 | hr { 25 | margin: 4rem 0; 26 | } 27 | 28 | .side-by-side { 29 | margin: 1rem auto; 30 | padding: 0 2rem; 31 | max-width: 80rem; 32 | } 33 | 34 | .video { 35 | height: 520px; 36 | display: flex; 37 | justify-content: space-between; 38 | gap: 2rem; 39 | } 40 | 41 | .video > * { 42 | width: calc(50% - 2rem); 43 | } 44 | 45 | .video .transcript { 46 | overflow: auto; 47 | padding: 1rem; 48 | border: 1px solid black; 49 | } 50 | 51 | .hide-show .transcript { 52 | /* height: 100%; */ 53 | } 54 | 55 | .collapse { 56 | height: 20ch; 57 | overflow: hidden; 58 | position: relative; 59 | } 60 | 61 | .collapse::after { 62 | position: absolute; 63 | bottom: 0; 64 | display: block; 65 | width: 100%; 66 | height: 4rem; 67 | content: ""; 68 | background: linear-gradient( 69 | 0deg, 70 | hsla(0, 0%, 100%, 1) 0%, 71 | hsla(0, 0%, 100%, 0) 100% 72 | ); 73 | } 74 | -------------------------------------------------------------------------------- /06_01/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Accessible mobile hamburger menu 10 | 11 | 12 | 29 |
30 |

A mobile navigation menu

31 |

32 | This is an example of a basic mobile navigation menu with accessibility 33 | built in. 34 |

35 |

36 | When you tab out of the menu, it automatically closes and focus is sent 37 | to the next focusable item, the link inside this 38 | paragraph. 39 |

40 |
41 | 42 | 43 | -------------------------------------------------------------------------------- /04_07/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, 3 | Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif; 4 | font-size: 20px; 5 | } 6 | /* Button reset */ 7 | button { 8 | font-family: inherit; 9 | font-size: 100%; 10 | line-height: 1.15; 11 | margin: 0; 12 | overflow: visible; 13 | text-transform: none; 14 | -webkit-appearance: button; 15 | border: 0; 16 | background: none; 17 | } 18 | 19 | button:hover { 20 | /* Mouse behavior like link */ 21 | cursor: pointer; 22 | } 23 | 24 | button:hover, 25 | button:focus, 26 | button:active { 27 | background: none; 28 | border-color: inherit; 29 | border-radius: 0; 30 | } 31 | 32 | #print-button { 33 | padding: 1rem; 34 | font-size: 1.5rem; 35 | border: 3px solid black; 36 | border-radius: 0.5rem; 37 | background-color: white; 38 | } 39 | 40 | #print-button:hover, 41 | #print-button:focus { 42 | color: white; 43 | background: black; 44 | } 45 | 46 | #print-button:active { 47 | background: hsl(0, 0%, 90%); 48 | } 49 | 50 | /* Icon style */ 51 | .icon { 52 | display: inline-block; 53 | width: 1em; 54 | height: 1em; 55 | stroke-width: 0; 56 | stroke: currentColor; 57 | fill: currentColor; 58 | } 59 | 60 | /* Screen reader only */ 61 | .sr-only { 62 | clip: rect(1px, 1px, 1px, 1px); 63 | clip-path: inset(50%); 64 | height: 1px; 65 | width: 1px; 66 | margin: -1px; 67 | overflow: hidden; 68 | padding: 0; 69 | position: absolute; 70 | } 71 | -------------------------------------------------------------------------------- /06_03/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Basic card with hidden text 9 | 10 | 11 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /06_01/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, 3 | Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif; 4 | font-size: 20px; 5 | } 6 | 7 | button { 8 | font-family: inherit; 9 | font-size: 100%; 10 | line-height: 1.15; 11 | margin: 0; 12 | overflow: visible; 13 | text-transform: none; 14 | -webkit-appearance: button; 15 | border: 0; 16 | background: none; 17 | } 18 | 19 | button:hover { 20 | cursor: pointer; 21 | } 22 | 23 | button:hover, 24 | button:focus, 25 | button:active { 26 | background: none; 27 | border-color: inherit; 28 | border-radius: 0; 29 | } 30 | 31 | .sr-only { 32 | clip: rect(1px, 1px, 1px, 1px); 33 | clip-path: inset(50%); 34 | height: 1px; 35 | width: 1px; 36 | margin: -1px; 37 | overflow: hidden; 38 | padding: 0; 39 | position: absolute; 40 | } 41 | 42 | .icon { 43 | display: inline-block; 44 | width: 1em; 45 | height: 1em; 46 | stroke-width: 0; 47 | stroke: currentColor; 48 | fill: currentColor; 49 | width: 1.375em; 50 | } 51 | 52 | .main-nav { 53 | position: relative; 54 | width: fit-content; 55 | } 56 | 57 | .main-nav ul { 58 | position: absolute; 59 | max-width: fit-content; 60 | list-style-type: none; 61 | display: flex; 62 | flex-direction: column; 63 | margin: 0; 64 | padding: 0; 65 | z-index: 1; 66 | } 67 | 68 | .main-nav li { 69 | position: relative; 70 | } 71 | 72 | .main-nav a, 73 | .menu-trigger { 74 | display: block; 75 | margin-block-end: 1ch; 76 | margin-inline-end: 1ch; 77 | padding: 0.3rem 0.5rem; 78 | border: 3px solid black; 79 | color: black; 80 | text-decoration: none; 81 | background: white; 82 | } 83 | 84 | .main-nav a:hover, 85 | .main-nav a:focus, 86 | .menu-trigger:hover, 87 | .menu-trigger:focus { 88 | background: black; 89 | color: white; 90 | border-color: black; 91 | } 92 | 93 | .main-nav ul.hide { 94 | display: none; 95 | } 96 | -------------------------------------------------------------------------------- /06_04/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Advanced card with multiple internal links 9 | 10 | 11 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Simplifying Web Development with Accessibility Best Practices 2 | This is the repository for the LinkedIn Learning course Simplifying Web Development with Accessibility Best Practices. The full course is available from [LinkedIn Learning][lil-course-url]. 3 | 4 | ![Simplifying Web Development with Accessibility Best Practices][lil-thumbnail-url] 5 | 6 | Too often in the world of web development, accessibility is given a low level of priority in the development stage of a site and is often relegated to experts for later implementation. But why spend the time and money hiring an outside consultant when you can set up a website for proper accessibility at the build stage? In this course, Morten Rand-Hendriksen shows the benefits of taking this approach, and how simple it is to do so. As Morten explains, all that’s needed is a basic understanding of why these elements are so important, how they work, and how good coding practices and modern web standards can get you there with little extra work. He tackles accessibility from all sides, starting with the origins of some of the most common accessibility issues and how to address them, then covers key topics like accessible design, hiding and showing visual content, handling graphics and media, and the semantic elements that can help make your designs more accessible. 7 | 8 | ## Installing 9 | 10 | The exercise files are stand-alone examples in HTML, CSS, and JavaScript. You do not need any additional software to run them, and you are free to copy the code and use it in your own projects. 11 | 12 | 13 | ### Instructor 14 | 15 | Morten Rand-Hendriksen 16 | 17 | Developer and Senior Staff Instructor 18 | 19 | 20 | 21 | Check out my other courses on [LinkedIn Learning](https://www.linkedin.com/learning/instructors/morten-rand-hendriksen). 22 | 23 | [lil-course-url]: https://www.linkedin.com/learning/simplifying-web-development-with-accessibility-best-practices 24 | [lil-thumbnail-url]: https://cdn.lynda.com/course/2883015/2883015-1622152000595-16x9.jpg 25 | -------------------------------------------------------------------------------- /06_02/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Accessible multi-level nav menu 10 | 11 | 12 | 38 |
39 |

A dropdown menu

40 |

41 | This is an example of a basic multi-level navigation menu with 42 | accessibility built in. 43 |

44 |

45 | Tabbing through the menu, you find links to top-level links, and buttons 46 | to open sub-level menus. 47 |

48 |

49 | When you tab out of the sub-level menu, it automatically closes and 50 | focus is sent to the next focusable item, either in the menu or in the 51 | document. 52 |

53 |
54 | 55 | 56 | -------------------------------------------------------------------------------- /06_02/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, 3 | Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif; 4 | font-size: 20px; 5 | } 6 | 7 | button { 8 | font-family: inherit; 9 | font-size: 100%; 10 | margin: 0; 11 | overflow: visible; 12 | text-transform: none; 13 | -webkit-appearance: button; 14 | border: 0; 15 | background: none; 16 | } 17 | 18 | button:hover { 19 | cursor: pointer; 20 | } 21 | 22 | button:hover, 23 | button:focus, 24 | button:active { 25 | background: none; 26 | border-color: inherit; 27 | border-radius: 0; 28 | } 29 | 30 | .skip-link { 31 | clip: rect(1px, 1px, 1px, 1px); 32 | clip-path: inset(50%); 33 | height: 1px; 34 | width: 1px; 35 | margin: -1px; 36 | overflow: hidden; 37 | padding: 0; 38 | position: absolute; 39 | } 40 | 41 | .skip-link:focus { 42 | clip: unset; 43 | clip-path: unset; 44 | height: auto; 45 | width: auto; 46 | margin: 0; 47 | padding: 1rem 1.5rem; 48 | background: white; 49 | z-index: 1; 50 | } 51 | 52 | .main-nav ul { 53 | list-style-type: none; 54 | display: flex; 55 | flex-wrap: wrap; 56 | margin: 0; 57 | padding: 0; 58 | } 59 | 60 | .main-nav li { 61 | position: relative; 62 | } 63 | 64 | .main-nav a, 65 | .menu-trigger { 66 | display: block; 67 | margin-block-end: 1ch; 68 | margin-inline-end: 1ch; 69 | padding: 0.3rem 0.5rem; 70 | border: 3px solid black; 71 | color: black; 72 | text-decoration: none; 73 | background: white; 74 | } 75 | 76 | .main-nav a:hover, 77 | .main-nav a:focus, 78 | .menu-trigger:hover, 79 | .menu-trigger:focus { 80 | background: black; 81 | color: white; 82 | border-color: black; 83 | } 84 | 85 | .main-nav ul ul { 86 | position: absolute; 87 | display: flex; 88 | flex-direction: column; 89 | z-index: 1; 90 | } 91 | 92 | .main-nav ul ul.hide { 93 | display: none; 94 | } 95 | 96 | .sub::after { 97 | display: inline-block; 98 | margin-inline-start: 0.5rem; 99 | content: ">"; 100 | transform: rotate(90deg); 101 | } 102 | -------------------------------------------------------------------------------- /06_02/script.js: -------------------------------------------------------------------------------- 1 | // Find all sub-menus. 2 | const subMenus = document.querySelectorAll(".main-nav ul ul"); 3 | // Find all sub-menu trigger buttons. */ 4 | const menuTriggers = document.querySelectorAll(".menu-trigger"); 5 | 6 | // Hide all sub-menus. 7 | subMenus.forEach((subMenu) => { 8 | subMenu.classList.add("hide"); 9 | }); 10 | 11 | /** 12 | * Toggle sub-menu open/closed. 13 | * @param {DOM node} parent 14 | * @param {boolean} status 15 | */ 16 | const toggleMenu = (parent, status) => { 17 | const trigger = parent.querySelector("button"); 18 | const subMenu = parent.querySelector("ul"); 19 | if (status == "false") { 20 | parent.classList.add("open"); 21 | subMenu.classList.remove("hide"); 22 | trigger.setAttribute("aria-expanded", "true"); 23 | trigger.setAttribute("aria-label", "Close news menu."); 24 | } else { 25 | parent.classList.remove("open"); 26 | subMenu.classList.add("hide"); 27 | trigger.setAttribute("aria-expanded", "false"); 28 | trigger.setAttribute("aria-label", "Open news menu."); 29 | } 30 | }; 31 | 32 | // For each trigger button: 33 | // - add a down-arrow 34 | // - set aria attributes 35 | // - add event listener 36 | menuTriggers.forEach((trigger) => { 37 | trigger.classList.add("sub"); 38 | trigger.setAttribute("aria-expanded", "false"); 39 | trigger.setAttribute("aria-label", "Open news menu."); 40 | trigger.addEventListener("click", function () { 41 | const parent = trigger.parentElement; 42 | const status = trigger.getAttribute("aria-expanded"); 43 | toggleMenu(parent, status); 44 | }); 45 | }); 46 | 47 | // Close sub-menus when user tabs outside menu. 48 | document.addEventListener("focusin", (e) => { 49 | let currentSubMenu = document.querySelector(".open"); 50 | if (currentSubMenu && e.target.closest(".has-sub-menu") !== currentSubMenu) { 51 | toggleMenu(currentSubMenu, true); 52 | } 53 | }); 54 | 55 | // Close sub-menus when user clicks outside menu. 56 | document.addEventListener("click", (e) => { 57 | let currentSubMenu = document.querySelector(".open"); 58 | if (currentSubMenu && e.target.closest(".has-sub-menu") !== currentSubMenu) { 59 | toggleMenu(currentSubMenu, true); 60 | } 61 | }); 62 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | LinkedIn Learning Exercise Files License Agreement 2 | ================================================== 3 | 4 | This License Agreement (the "Agreement") is a binding legal agreement 5 | between you (as an individual or entity, as applicable) and LinkedIn 6 | Corporation (“LinkedIn”). By downloading or using the LinkedIn Learning 7 | exercise files in this repository (“Licensed Materials”), you agree to 8 | be bound by the terms of this Agreement. If you do not agree to these 9 | terms, do not download or use the Licensed Materials. 10 | 11 | 1. License. 12 | - a. Subject to the terms of this Agreement, LinkedIn hereby grants LinkedIn 13 | members during their LinkedIn Learning subscription a non-exclusive, 14 | non-transferable copyright license, for internal use only, to 1) make a 15 | reasonable number of copies of the Licensed Materials, and 2) make 16 | derivative works of the Licensed Materials for the sole purpose of 17 | practicing skills taught in LinkedIn Learning courses. 18 | - b. Distribution. Unless otherwise noted in the Licensed Materials, subject 19 | to the terms of this Agreement, LinkedIn hereby grants LinkedIn members 20 | with a LinkedIn Learning subscription a non-exclusive, non-transferable 21 | copyright license to distribute the Licensed Materials, except the 22 | Licensed Materials may not be included in any product or service (or 23 | otherwise used) to instruct or educate others. 24 | 25 | 2. Restrictions and Intellectual Property. 26 | - a. You may not to use, modify, copy, make derivative works of, publish, 27 | distribute, rent, lease, sell, sublicense, assign or otherwise transfer the 28 | Licensed Materials, except as expressly set forth above in Section 1. 29 | - b. Linkedin (and its licensors) retains its intellectual property rights 30 | in the Licensed Materials. Except as expressly set forth in Section 1, 31 | LinkedIn grants no licenses. 32 | - c. You indemnify LinkedIn and its licensors and affiliates for i) any 33 | alleged infringement or misappropriation of any intellectual property rights 34 | of any third party based on modifications you make to the Licensed Materials, 35 | ii) any claims arising from your use or distribution of all or part of the 36 | Licensed Materials and iii) a breach of this Agreement. You will defend, hold 37 | harmless, and indemnify LinkedIn and its affiliates (and our and their 38 | respective employees, shareholders, and directors) from any claim or action 39 | brought by a third party, including all damages, liabilities, costs and 40 | expenses, including reasonable attorneys’ fees, to the extent resulting from, 41 | alleged to have resulted from, or in connection with: (a) your breach of your 42 | obligations herein; or (b) your use or distribution of any Licensed Materials. 43 | 44 | 3. Open source. This code may include open source software, which may be 45 | subject to other license terms as provided in the files. 46 | 47 | 4. Warranty Disclaimer. LINKEDIN PROVIDES THE LICENSED MATERIALS ON AN “AS IS” 48 | AND “AS AVAILABLE” BASIS. LINKEDIN MAKES NO REPRESENTATION OR WARRANTY, 49 | WHETHER EXPRESS OR IMPLIED, ABOUT THE LICENSED MATERIALS, INCLUDING ANY 50 | REPRESENTATION THAT THE LICENSED MATERIALS WILL BE FREE OF ERRORS, BUGS OR 51 | INTERRUPTIONS, OR THAT THE LICENSED MATERIALS ARE ACCURATE, COMPLETE OR 52 | OTHERWISE VALID. TO THE FULLEST EXTENT PERMITTED BY LAW, LINKEDIN AND ITS 53 | AFFILIATES DISCLAIM ANY IMPLIED OR STATUTORY WARRANTY OR CONDITION, INCLUDING 54 | ANY IMPLIED WARRANTY OR CONDITION OF MERCHANTABILITY OR FITNESS FOR A 55 | PARTICULAR PURPOSE, AVAILABILITY, SECURITY, TITLE AND/OR NON-INFRINGEMENT. 56 | YOUR USE OF THE LICENSED MATERIALS IS AT YOUR OWN DISCRETION AND RISK, AND 57 | YOU WILL BE SOLELY RESPONSIBLE FOR ANY DAMAGE THAT RESULTS FROM USE OF THE 58 | LICENSED MATERIALS TO YOUR COMPUTER SYSTEM OR LOSS OF DATA. NO ADVICE OR 59 | INFORMATION, WHETHER ORAL OR WRITTEN, OBTAINED BY YOU FROM US OR THROUGH OR 60 | FROM THE LICENSED MATERIALS WILL CREATE ANY WARRANTY OR CONDITION NOT 61 | EXPRESSLY STATED IN THESE TERMS. 62 | 63 | 5. Limitation of Liability. LINKEDIN SHALL NOT BE LIABLE FOR ANY INDIRECT, 64 | INCIDENTAL, SPECIAL, PUNITIVE, CONSEQUENTIAL OR EXEMPLARY DAMAGES, INCLUDING 65 | BUT NOT LIMITED TO, DAMAGES FOR LOSS OF PROFITS, GOODWILL, USE, DATA OR OTHER 66 | INTANGIBLE LOSSES . IN NO EVENT WILL LINKEDIN'S AGGREGATE LIABILITY TO YOU 67 | EXCEED $100. THIS LIMITATION OF LIABILITY SHALL: 68 | - i. APPLY REGARDLESS OF WHETHER (A) YOU BASE YOUR CLAIM ON CONTRACT, TORT, 69 | STATUTE, OR ANY OTHER LEGAL THEORY, (B) WE KNEW OR SHOULD HAVE KNOWN ABOUT 70 | THE POSSIBILITY OF SUCH DAMAGES, OR (C) THE LIMITED REMEDIES PROVIDED IN THIS 71 | SECTION FAIL OF THEIR ESSENTIAL PURPOSE; AND 72 | - ii. NOT APPLY TO ANY DAMAGE THAT LINKEDIN MAY CAUSE YOU INTENTIONALLY OR 73 | KNOWINGLY IN VIOLATION OF THESE TERMS OR APPLICABLE LAW, OR AS OTHERWISE 74 | MANDATED BY APPLICABLE LAW THAT CANNOT BE DISCLAIMED IN THESE TERMS. 75 | 76 | 6. Termination. This Agreement automatically terminates upon your breach of 77 | this Agreement or termination of your LinkedIn Learning subscription. On 78 | termination, all licenses granted under this Agreement will terminate 79 | immediately and you will delete the Licensed Materials. Sections 2-7 of this 80 | Agreement survive any termination of this Agreement. LinkedIn may discontinue 81 | the availability of some or all of the Licensed Materials at any time for any 82 | reason. 83 | 84 | 7. Miscellaneous. This Agreement will be governed by and construed in 85 | accordance with the laws of the State of California without regard to conflict 86 | of laws principles. The exclusive forum for any disputes arising out of or 87 | relating to this Agreement shall be an appropriate federal or state court 88 | sitting in the County of Santa Clara, State of California. If LinkedIn does 89 | not act to enforce a breach of this Agreement, that does not mean that 90 | LinkedIn has waived its right to enforce this Agreement. The Agreement does 91 | not create a partnership, agency relationship, or joint venture between the 92 | parties. Neither party has the power or authority to bind the other or to 93 | create any obligation or responsibility on behalf of the other. You may not, 94 | without LinkedIn’s prior written consent, assign or delegate any rights or 95 | obligations under these terms, including in connection with a change of 96 | control. Any purported assignment and delegation shall be ineffective. The 97 | Agreement shall bind and inure to the benefit of the parties, their respective 98 | successors and permitted assigns. If any provision of the Agreement is 99 | unenforceable, that provision will be modified to render it enforceable to the 100 | extent possible to give effect to the parties’ intentions and the remaining 101 | provisions will not be affected. This Agreement is the only agreement between 102 | you and LinkedIn regarding the Licensed Materials, and supersedes all prior 103 | agreements relating to the Licensed Materials. 104 | 105 | Last Updated: March 2019 106 | -------------------------------------------------------------------------------- /05_04/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Accessible SVG example 9 | 10 | 11 |

A button with CSS reset applied

12 | 24 | Mr. Red 25 | 26 | A red monster with four purple arms screaming, or singing perhaps. 27 | 28 | 64 | 68 | 72 | 76 | 80 | 84 | 88 | 92 | 96 | 100 | 104 | 108 | 112 | 116 | 117 | 118 | 126 | 134 | 135 | 136 | 137 | -------------------------------------------------------------------------------- /05_06/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Two alternative transcript options 10 | 11 | 12 |
13 |
14 |

Transcript in overflow box

15 |
16 | 34 | 149 |
150 |
151 |
152 |
153 |

Transcript with hide/show functionality

154 | 172 | 291 |
292 |

Something

293 |

An article with some content could go here.

294 |
295 |
296 | 297 | 298 | --------------------------------------------------------------------------------