Skip to content

Latest commit

 

History

History

1. Accessible and Responsive Web Apps

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Accessible & Responsive Web Apps (due April 6th)

1. Why Responsive:

  1. Quiz 8

Hold Down Ctrl+Shift+M (toggles device toolbar). Then from the drop-down menu select Edit/Add Custom Device.

2. Starting Small:

  1. Defining the Viewport

His screen is 2560px wide. However, when he opens the viewport width it shows 1280px.
WHY? Because not all pixels are created equal.

  1. Pixels, pixels and more pixels!

Hardware Pixels vs. Device-Independent Pixels
DIP will always take the same amount of display on the screen regardless of the pixel density of the display. The 1280px DIPs scales up to 2560px HP. So you should always include the viewport meta tag in your pages.

  1. Pixelation

Mobile device pixels that found on the specs are the HP.

  1. Calculating DPR

With one DIP for every two hardware pixels, the device pixel ratio is 2.

  1. What's the difference?

The viewport and the device pixel ratio are both likely causes for the differences between devices.

  1. Calculating CSS pixels

Divide 1920px by 2 and you will get the answer. :)

  1. How wide is the viewport?

To solve the quiz divide the pixels by the DPR number.

  1. Setting the Viewport

initial-scale=1.0 means that the ratio between the DIP and CSS pixels is 1:1.

  1. Setting the Viewport

To pass the quiz add <meta name="viewport" content="width=device-width, initial-scale=1.0"> to the header of the site.

  1. Large Fixed Width Elements

Using fixed width or absolute positions is not recommended. You should use relative positions.

  1. Max-width on elements

Setting a max-width of 100% should avoid overflow for most elements.

img, embed,
object, video {
  max-width: 100%;
}
  1. Relative Sizes max-width overrides width so if you have them both then the max width will overrides the styles.

  2. Tap Target Sizes

Human fingers are at least 40 CSS pixels. So it is safer to give your buttons a Height and width of 48px.

  1. Tap Targets

min-width: 48px; min-height: 48px;

  1. Start Small

Starting small (eg. mobile first) might remove the need to re-design your website for larger screens.

  1. Project Part 1 Inspect Styles

The full answer of this quiz is in lesson 17.

3. Building Up

  1. Lesson Intro

  2. Basic Media Query Intro

Media queries are used to apply styles depending on device characterstics.

  1. Adding a basic media query

Using Media Queries [MDN]

  1. Adding a basic media query 2

min-width:500px means that the MQ will be triggered and styles applied only if the viewport is bigger than 500px.

  1. Next Step Media Queries

Developers usually use max-width and min-width media queries because they are relatively error-proof. Max-width styles get applied when the viewport is smaller than the specified width.

  1. Which styles are applied?

Remove what is there and change it with this code.

body {
    background-color: green;
}

@media screen and (min-width: 600px) {
    body {
        background-color: blue;
    }
}

@media screen and (max-width: 400px) {
    body {
        background-color: red;
    }
}
  1. Breakpoints

Predefined widths at which majors layout changes happen. For example, swapping the main navigation for a burger one or other hidden version suitable for smaller screens.

  1. Breakpoints Pt. II

To see the screen resolution of the window you need to open DevTools. In that lessons you don't see the devtools open because he opened the DevTools in a separate window.

  1. Number of Breakpoints

2 for medium.com and 2 for the course example.

  1. Picking Breakpoints

Use your content as a guide to pick your breakpoints.

  1. Picking Breakpoints 2

  2. Pick a Breakpoint

  3. Complex Media Queries

  4. What Styles Are Applied? Guide

@media screen and ( max-width:400px)
@media screen and ( min-width:301px) and ( max-width:600px)
@media screen and ( min-width:601px)
@media screen and ( min-width:961px)
  1. Grids Helpful Guide

Bootstrap and 960

  1. Flexbox Intro

  2. Flex Item

Using the order you can change the order to whatever you want.

  1. Deconstructing a Flexbox Layout

  2. Deconstructing a Flexbox Layout

  3. Deconstructing a Flexbox Layout(quiz)

Three columns width will be 33.33% because it will give you around 99.99%, almost 100%.

4. Common Responsive Patterns

Walk through the most popular responsive layout patterns and learn the tools needed to implement them in your own designs.

  1. Intro to Patterns

There are 4 patterns: Mostly Fluid, Column Drop, Layout Shifter, Off Canvas

  1. Pattern - Column Drop

  2. Pattern - Mostly Fluid

  3. Mostly Fluid Part 1(quiz)

  4. Mostly Fluid Part 2(quiz)

The red is 33 and not 25.

  1. Combining Fluid Layouts

  2. Pattern - Layout Shifter

  3. Which is Which?

  4. Pattern - Off Canvas

  5. Off Canvas Visualization

  6. Project Part 2

5. Optimizations

Learn how to optimize images, tables, and fonts to make for the best responsive layouts.

1.Lesson Intro

  1. Images

You could have a high quality image as well as a smaller one.

  1. Tables

Hiddedn Colums / No More Tables / Contained Tables

  1. Responsive Tables - Hidden Columns

The drawback of this approach is that you hide content from the users.

  1. Hide Some Columns helpful link

@media screen and (max-width:499px){ .gametime { display:none } }

  1. Responsive Tables - No More Tables

This technique show all the data the users want to see

  1. Responsive Tables - Contained Scrolling

  2. Fonts

9.Minor Breakpoints

Like changing the icons size or making the font a bit bigger.

10.Project.

6. Getting Up and Running

Sam Dutton, the developer advocate at Google, explains the importance of getting responsive images right and helps you set up mobile developer tools.

  1. Course Introduction

  2. Why Responsive Images?

They shoud work no matter the screen size is.

  1. Intro to Project

  2. Setting up Your Environment

  3. Setup for mobile Helpful Link

  4. Using dev tools on mobile

  5. Mobile tools for iOS Helpful Link

  6. Lesson Wrap Up

7. Units, Formats, Environments

Optimize images to display beautifully on all screen sizes. Learn about the difference between Raster vs Vector images, responsive CSS units, and setting up optimization tools.

  1. Sizing Intro

Make sure the recording icon is red. Then disable the cache. Then Hit F5.

To manipulate an element in the DOM. CLick on that element. (In your console) type $0. If the console is not showing below your element tab then go the horizontal three dots and click on show console drawer.

Edit DOM Firefox DOM_Property_Viewer Chrome DOM_Property_Viewer

In Chrome: You can see all the DOM Properties for a certain element by using console.dir($0)

// For checking the width of the img
$0.naturalwidth
  1. All about Bits and Pixels

  2. Requests and Revenue

  3. Relative Sizing Calc

  1. IMPORTANT! Udacity Front End Feedback Extension

  2. calc()

Note: There MUST be a space on each side of the + and - operators. (A space is not required around * and / as the problem is an ambiguity around negation.) For example: calc(100px - 10%) will work. calc(100px-10%) will not.

margin-right: 10px;
width: calc((100% - 20px)/3);

/* This means that there is no margin right after the last img */
img:last-of-type{
margin-right: 0;
}
  1. Landscape and Portrait

Don't assume the view-port will always stay the same. The screen orientation can rotate and miss up your calculation

8.Less Well Known CSS Units

vh and vw. viewport height and viewport width. vmin and vmax

  1. Raster and Vector vector-vs-raster-what-do-i-use

  2. Rastor or Vector ?

Vector images can be scaled infinitely, which means that it'll be sharp and clear even on a 50m banner

  1. Raster and Vector Identification

SVG are vectors. JPG and PNG are Raster

  1. File formats

Use svg because it is really small and fast.

  1. Spot the Differences

  2. Spot the Differences 2

Compression ratio is different

  1. Image Compression pagespeed

  2. Project Part 1 imagemagick grunt-is-not-weird srcset-with-grunt grunt-responsive-images

  • checkmark 'add to PATH'
  • in gruntfile.js change the line 'engine:im' to 'engine:gm' which basically tells grunt to look for graphicsMagick(gm) instead of ImageMagick(im)
// Download imagemagick for your OS https://www.imagemagick.org/script/download.php
// Make sure you add it to the path variable
// cd to the project folder then type

npm install
npm install -g grunt

// inside the grunt file change the line 'engine:im' to 'engine:gm'
//Also add this code
width: 1600,
suffix: '_large_2x',
quality: 30
// ready!set!responsiveimages!

If the grunt tool didn't work for you. This website can be helpful (http://compressimage.toolur.com)

8. Images with Markup

Dive deep into image alternatives like CSS and icon fonts and learn common strategies to alleviate latency.

  1. Performance

  2. Text Problems

  3. CSS Techniques fast-loading

  4. CSS background images

  5. CSS background image techniques

cover vs contain

  1. Symbol characters

You might find your symbol as charaters which will inherit all the text properties.

  1. Unicode Treble Clef Unicode Table

  2. Icon Fonts zocial fontawesome weloveiconfonts CSS Tricks ARIA

  3. Inlining images with SVG and data URIs

  4. Strategy Quiz 1

  5. Strategy Quiz 2

  6. Strategy Quiz 3

  7. Strategy Quiz 4

  8. Project Part 2

9. Full Responsiveness

Learn to use the srcset attribute and the picture element to choose images of the right size for your application for every viewing context.

  1. Responding to Screen Capability & View

Media queris will not help. There are other ways.

  1. srcset

There are two flavors of srcset, one using x to differentiate between device pixel ratios (DPR), and the other using w to describe the image's width.

window.devicePixelRatio - will give you your device pixel ratio

srcset-sizes high-dpi pixe density

  1. Sizes Attribute

In JavaScript you can get the source of an img element with currentSrc. The sizes attribute gives the browser information about the display size of an image element – it does not actually cause the image to be resized. That's done in CSS!

  1. Srcset

Reacting to Device Pixel Ratio

Set srcset equal to a comma separated string of filename multiplier pairs, where each multiplier must be an integer followed by an x. For example, 1x represents 1x displays and 2x represents displays with twice the pixel density, like Apple's Retina displays. The browser will download the image that best corresponds to its DPR . Also, note that there's a src attribute as a fallback.

Reacting to Image Width

Set srcset equal to a comma separated string of filename widthDescriptor pairs, where each widthDescriptor is measured in pixels and must be an integer followed by a w. Here, the widthDescriptor gives the natural width of each image file, which enables the browser to choose the most appropriate image to request, depending on viewport size and DPR. (Without the widthDescriptor, the browser cannot know the width of an image without downloading it!)

<img class="dpi" src="images/Den_Haag_2x.jpg" srcset="images/Den_Haag_2x.jpg 2x, images/Den_Haag_1x.jpg 1x" alt="Den Haag Skyline">
<img class="w" src="images/Australia_1280w.jpg" srcset="images/Australia_1280w.jpg 1280w, images/Australia_640w.jpg 640w" alt="Australia from Space">
  1. Scrset and Sizes

What if the image won't be displayed at the full viewport width? Then you need something more than srcset, which assumes the image will be full viewport width. Add a sizes attribute to the image with a media query and a vw value. srcset and sizes together tell the browser the natural width of the image, and how wide the image will be displayed relative to viewport width. Knowing the display width of the image and the widths of the image files available to it, the browser has the information it needs to download the image with the right resolution for its needs that is as small as possible. And it can make this choice early in the page load while the HTML is still being parsed.

<img  src="images/great_pic_800.jpg"
      sizes="(max-width: 400px) 100vw, (min-width: 401px) 50vw"
      srcset="images/great_pic_400.jpg 400w, images/great_pic_800.jpg 800w"
      alt="great picture">
<!-- Quiz Answer -->
<img class="w" src="images/Coffee_1280w.jpg" srcset="images/Coffee_1280w.jpg 1280w, images/Coffee_640w.jpg 640w" sizes="(max-width: 960px) 50vw, 100vw" alt="Coffee by Amy March from Turkey">

sizes consists of comma separated mediaQuery width pairs. sizes tells the browser early in the load process that the image will be displayed at some width when the mediaQuery is hit. In fact, if sizes is missing, the browser defaults sizes to 100vw, meaning that it expects the image will display at the full viewport width. sizes gives the browser one more piece of information to ensure that it downloads the right image file based on the eventual display width of the image. Just to be clear, it does not actually resize the image - that's what CSS does. In this example, the browser knows that the image will be full viewport width if the browser's viewport is 400px wide or less, and half viewport width if greater than 400px. It knows that it has two image options - one with a natural width of 400px and the other 800px.

  1. The Picture Element

  2. The Full Monty Element/picture

  3. Accessibility

General advice about alt attributes alt attributes should be descriptive for important images, like this body surfer. Because body surfing is important, I guess. alt attributes should be empty for images that are just decorations, like this boiler image. Do you get the joke? It's a boiler to represent boiler plate code, which is sometimes empty of content. alt attributes should be set on every image, just like this pig is set on being so darn cute.

  1. Accessibility Promise

  2. Project

allthepictures,allthetime

10. Accessibility Overview

Explore the diversity of different users experience with websites and applications. Learn about using screen readers practically and recognize the challenge of building web experiences for all users.

  1. Introduction to Accessibility Google and Udacity course on Accessibility.

We often shorten the word "accessibility" to "a11y" because there's 11 letters between the "A" and "Y" in the word "Accessibility"

  1. What is Accessibility

  2. Understanding the diversity of users

Some statistics on disability for the US: Around 2% of the population has some kind of vision disability (i.e. are blind or have significant difficulty seeing even with glasses) Around 50% of the population has some kind of clinically significant refractive error (a visual impairment which may be corrected with glasses if mild enough) Around 8% of males and 0.5% of females have some form of color vision deficiency Around 2% of adults have a hearing disability Over 4% have a cognitive disability (difficulty remembering, concentrating, or making decisions)

  1. Diversity of Users (Broken Arm)

Correct! A broken arm would be a motor impairment that is temporary.

  1. Diversity of Users (Blindness)

  2. Diversity of Users (Audio)

  3. Diversity of Users (Baby)

Holding a baby in one arm will definitely impact someone's motor abilities.

  1. Diversity of Users (Concussion)

A concussion can impair a person's visual and cognitive abilities. A concussion is a temporary impairment.

  1. Diversity of Users (RSI)

RSI can be a temporary or permanent impairment. RSI can be a temporary or permanent impairment.

  1. Using a Screen Reader

  2. Experiencing a screen reader

Koala

  1. Checklists Web Content Accessibility Guidelines (WCAG) 2.0 WebAIM's

  2. Using WebAIM Checklist

Operable 2.4.2

  1. Gear Shift into Course Practicalities

11. Focus

Manage focus - the location on a page that receives input from the keyboard. Discover how some users navigate website entirely with the keyboard, and how to optimize their experience.

  1. Introduction to Focus

  2. What is Focus?

TAB will move focus forward / SHIFT - TAB will move focus backwards / Arrow keys can be used to navigate inside of a component

  1. Experiencing Focus

  2. DOM Order Matters

  3. Fixing DOM Order

  4. Using tabindex tabindex

  5. Deciding whats in focus

  6. Which Elements Should Have Focus?

  7. Managing Focus

  8. Manage Focus Yourself

  1. Skip Links Skiplink

  2. Focus in Complex Components aria

  3. Keyboard Design Patterns

  4. Implementing Keyboard Event Listeners

lesson2-focus/05-radio-group

  1. Offscreen Content

To find your missing focus you can type the following into your console: document.activeElement

  1. Implementing Offscreen Content

Changing the css for the specific class to display:none; will remove that element for the tab order.

  1. Modals and Keyboard Traps

12. Semantics Basics

Dive into the differences between visual UI and semantically designed accessible UI. Add semantic elements to HTML to create a user interface that works for everyone.

  1. Semantics Introduction

  2. Assistive Technology

  3. Affordances

Are cues. Such as buttons and scroll bar. When you see a button you already know that you can click it. Even if nobody told you.

  1. Experiencing Affordances

  2. Semantics and Assistive Technology

  3. Experience Using a Screenreader

  4. Role, Name, Value

  5. Experience a Screen Reader 2

  6. The Accessibility Tree

  1. Matching simple DOM and A11y Tree

  1. Semantics in Native HTML

  2. Writing Semantic HTML Quiz

  1. Writing Semantic HTML: The Name Game

  2. Labeling Input Elements

Using the ChromeVox you could easily tell which element has a label because it is going to read it out loud.

  1. Text Alternatives

If you want to skip your image form being read by the screen reader, then you should give your image an empty alt text alt=""

  1. Labeling Images With ALT Text

13. Navigating Content

Implement effective semantic navigation using headings, link text and landmarks.

  1. Semantics - Navigating content - Intro

  2. Navigating with a screen reader

  3. Navigating by Headings

  4. Using Headings

  1. Using Headings

  1. Other navigational options

  2. Other navigational options example

CTRL+Option+U to open Web Rotor
← and → to change panes within Web Rotor
Type search term with Web Rotor open to search within Web Rotor
Enter to move VoiceOver focus to item from Web Rotor
CTRL + Option + Spacebar to activate link/button/other element
CTRL + Option + ← ↑ ↓ → to explore content
CTRL + Option + CMD + H to move forward by heading
CTRL + Option + CMD + Shift + H to move backward by heading
CTRL + Option + W to have a word spelled out
  1. Link Text

  2. Link Text Quiz

  3. Landmarks

  4. Landmarks Quiz

14. ARIA

Sometimes an HTML element may not have a role or value assigned semantically. In this lesson, you'll use ARIA attributes to provide context for screen readers.

  1. Intro to Semantics: ARIA

  2. Why ARIA

  1. First Steps with ARIA

  2. What can ARIA do for you?

  1. Roleplaying

  2. Custom radio button group with ARIA

  1. More Ways to Label

  1. Name That Element!

  1. Breather

  2. Default Semantics and Landmarks

  1. ARIA Relationships

  2. Combo Box

By using aria-setsize appropriately, we can tell assistive technology how many items are within an option or listitem element.

  1. Hidden In Plain Sight

  1. Name That Element Round 2

  1. Recap so far

  2. Introducing ARIA Live

  3. Atomic Relevant Busy

  1. Recap

  2. Modal Dialog Quiz

15. Style

Incorporate CSS styling into your accessible web design and use accessible colour schemes to improve accessibility.

  1. Introduction to Style

  2. Working with focus styles

Sometimes the default blue focus doesn't fit your desgin. For that you can use the Voice

  1. Write your own focus styles

  1. Input Modality

  1. Styling with Aria

  2. Quiz: Styling with ARIA

  1. Responsive design for multi-device

  2. Responsive design for multi-device Pt. 2

  1. Mobile Screen Readers

  2. Mobile Screen Readers iOS

It's called voice over. You might need to install the english language.It can be also called Voice Assistant

  1. Mobile Screen Readers Android

It's called Talkback

  1. Using Mobile Screen Readers

Kangaroo

  1. Seque to Color & Contrast

  2. Meeting Contrast Requirements

  3. Contrast Audit

  4. Don’t convey info with color alone

  5. High Contrast Mode

16. The Benefits of Offline First

17. Introducing the Service Worker

PROJECT - Restaurant Reviews App — Stage 1

In this real-world case study, given the front-end code for a static Restaurant Reviews App, revise the site to be responsive and achieve accessibility standards.