Hinting at a better web FWDays edition

A presentation at JavaScript FWDays in March 2019 in Kyiv, Ukraine, 02000 by Chris Heilmann

Slide 1

Slide 1

Hinting at a better web Chris Heilmann Microsoft

Slide 2

Slide 2

Happy 30th birthday, World Wide Web! @codepo8

Slide 3

Slide 3

30th Happy birthday, World Wide Web! @codepo8 ▪ Excellent publishing medium ▪ Low barrier to entry ▪ Dumb, sturdy technologies and ideas - reliability beats finesse

Slide 4

Slide 4

The need to be forgiving… @codepo8 ▪ Anyone is allowed to write code for the web – or use whatever they want to create that code. ▪ Users shouldn’t suffer from developer errors; user agents need to be forgiving (RIP XHTML). ▪ What you put on the web will not be consumed the way you intended it to – your products need to be flexible.

Slide 5

Slide 5

World Wide Mess @codepo8 ▪ This freedom meant people took liberties… ▪ As things “just work”, we spent years adding suboptimal products to the web. ▪ These legacy products are likely to never get fixed – maintenance is boring. ▪ Browsers are big and slow because they need to show the web of yesterday, today and tomorrow.

Slide 6

Slide 6

World Wide Mess @codepo8 https://httparchive.org/reports/page-weight

Slide 7

Slide 7

The web is made for humans… @codepo8 ▪ Control of content is in the hand of the consumer ▪ We build things for people to consume in a simple fashion ▪ We build things for people to do tasks with – our job is to make that easy ▪ Humans are not in a binary state, we change over time and have different needs

Slide 8

Slide 8

On the web, we should care about… Accessibility Interoperability Performance Security

Slide 9

Slide 9

What we do care about is… Time to market Constant innovation

Slide 10

Slide 10

The web is an accessibility mess… @codepo8 https://majestic.com/reports/majestic-million https://webaim.org/projects/million/

Slide 11

Slide 11

Rampant accessibility failures… @codepo8 https://majestic.com/reports/majestic-million https://webaim.org/projects/million/

Slide 12

Slide 12

Problems caused by framework usage @codepo8 https://majestic.com/reports/majestic-million https://webaim.org/projects/million/

Slide 13

Slide 13

Problems caused by library usage @codepo8 https://majestic.com/reports/majestic-million https://webaim.org/projects/million/

Slide 14

Slide 14

“ Problems caused by library usage @codepo8 The vast majority of the top one million home pages utilize jQuery. Home pages with jQuery averaged 19.2 more errors than those without jQuery. The presence of https://majestic.com/reports/majestic-million jQuery corresponds with nearly 15 million detected errors, or over 25% of all of the accessibility errors we detected. https://majestic.com/reports/majestic-million https://webaim.org/projects/million/

Slide 15

Slide 15

Basic things get forgotten… @codepo8

Slide 16

Slide 16

Basic things get forgotten… @codepo8

Slide 17

Slide 17

Even better – we concentrate on the wrong things… @codepo8

Slide 18

Slide 18

Even better – we concentrate on the wrong things… @codepo8

Slide 19

Slide 19

Even better – we concentrate on the wrong things… @codepo8

Slide 20

Slide 20

Even better – we concentrate on the wrong things… @codepo8

Slide 21

Slide 21

▪ It is easy to feel out of the loop ▪ Often we pad our products with solutions because we want to be seen using them – as they are “professional” ▪ It doesn’t feel enough to build a sturdy product – it needs to be clever ▪ We overcomplicate our job requirements and block prospective new talent And we keep busy… @codepo8

Slide 22

Slide 22

Let’s take a breath and think web… @codepo8 ▪ It is not about our convenience as developers or our business plans ▪ It is about creating content and tools for human consumption ▪ The good news is that in our current environment, we have a great platform for that

Slide 23

Slide 23

$ cd ..

Slide 24

Slide 24

HTML CSS JavaScript

Slide 25

Slide 25

HTML @codepo8 ▪ Is the foundation of any web interface ▪ HTML elements come with lots of free accessibility and interaction features ▪ Static HTML can be cached and compresses down to almost nothing ▪ You can’t go wrong by betting on HTML these days

Slide 26

Slide 26

▪ Allows you to style elements and give them a certain look and feel ▪ Is a fully-fledged layout engine for complex interfaces with unknown content and reading direction (Flexbox / Grid) ▪ Is an animation/transition engine that allows you to create performant animations that the browser controls for you ▪ Has variables and conditions ▪ Can react to changes in the environment. CSS @codepo8

Slide 27

Slide 27

JavaScript @codepo8 ▪ Allows you to do everything, even creating the other two technologies ▪ Can be used on the server, on the client and in applications – each of which follows different rules ▪ Puts you in control and makes you responsible for performance, maintainability and reliability ▪ Is finally standardized, but also fast moving and easy to lose track

Slide 28

Slide 28

HTML Responsibilities Browser Standard CSS JavaScript Responsibilities You Browser Standard Responsibilities You Browser Standard You

Slide 29

Slide 29

▪ We have evergreen browsers with in-built development tools ▪ We have virtualized testing built into browsers (mobile view, simulated connections) We live in great tooling times… ▪ We have community channels to share our code and solutions and ways to discuss our approaches ▪ We have excellent, up-to-date documentation @codepo8

Slide 30

Slide 30

So why don’t we build great solutions? @codepo8 ▪ Resources with upvoting options favour the how over the why ▪ We’re not paid to learn, we’re paid to deliver ▪ Peer pressure makes developers who don’t know things afraid to admit it ▪ There’s always a “good enough” way to create a lot in a short amount of time.

Slide 31

Slide 31

Web Developers need to know a lot… @codepo8 ▪ Performance ▪ Accessibility ▪ Interoperability ▪ Security ▪ Maintainability ▪ Browser Quirks ▪ Developer toolchains ▪ Browser developer tools ▪ Abstractions ▪ CLI ▪ Editors

Slide 32

Slide 32

The web is assembled, not authored… @codepo8 https://discuss.httparchive.org/t/what-is-the-distribution-of1st-party-vs-3rd-party-resources/100/14

Slide 33

Slide 33

Third party slowness and cruft… @codepo8 https://github.com/patrickhulce/third-party-web

Slide 34

Slide 34

The mess that created… @codepo8 ▪ The web has become a render target amongst many others ▪ Releasing often and developer convenience trumps semantics and performance of the final product ▪ Web sites are slow and huge because we work on fast computers and good connections

Slide 35

Slide 35

The mess that created… @codepo8

Slide 36

Slide 36

Can you say that your product is OK with… Accessibility Interoperability Performance Security

Slide 37

Slide 37

Let’s talk tools…

Slide 38

Slide 38

Browser tool audits… @codepo8

Slide 39

Slide 39

Auditing report @codepo8

Slide 40

Slide 40

Accessibility Insights ▪ Browser extension for Chrome or Windows app – depending on what you want to test ▪ Open source collaboration of Deque and Microsoft ▪ Community driven with Github as the communication channel ▪ Customisable to your bug reporting tool https://accessibilityinsights.io/ @codepo8

Slide 41

Slide 41

Accessibility Insights https://accessibilityinsights.io/ @codepo8

Slide 42

Slide 42

Accessibility Insights https://accessibilityinsights.io/ @codepo8

Slide 43

Slide 43

Accessibility Insights https://accessibilityinsights.io/ @codepo8

Slide 44

Slide 44

Accessibility Insights https://accessibilityinsights.io/ @codepo8

Slide 45

Slide 45

Accessibility Insights https://accessibilityinsights.io/ @codepo8

Slide 46

Slide 46

Accessibility Insights https://accessibilityinsights.io/ @codepo8

Slide 47

Slide 47

Accessibility Insights https://accessibilityinsights.io/ @codepo8

Slide 48

Slide 48

Accessibility Insights https://accessibilityinsights.io/ @codepo8

Slide 49

Slide 49

Customisable best practices in context @codepo8 ▪ Having information isn’t enough when people don’t go there ▪ We need to prevent mistakes before they happen ▪ We need to allow people to customize these experiences. An intranet site needs different settings than a marketing site ▪ So, let’s target editors and build processes

Slide 50

Slide 50

Linting and inline insights in editors @codepo8 code.visualstudio.com

Slide 51

Slide 51

https://github.com/webhintio https://webhint.io https://www.npmjs.com/package/hint

Slide 52

Slide 52

Things that webhint helps you with… Performance Development environment Accessibility PWA Readiness Interoperability Security

Slide 53

Slide 53

@codepo8

Slide 54

Slide 54

Adding experience to build processes… @codepo8 ▪ A web interface or browser dev tools to get reports doesn’t scale to production ▪ Why not add best practices as part of your build/deployment process? ▪ That way you can also test the setup of your bundler/preprocessor to avoid huge release sizes

Slide 55

Slide 55

▪ Once you know what your product’s needs are, you can turn different tests on and off Customise the tests to your needs… @codepo8 ▪ You can also write your own tests to become part of the scan – like “make sure every footer has a picture of a leprechaun” – just one example ▪ You can create these with a cli wizard: $ npm create hintrc

Slide 56

Slide 56

webhint @code extension https://medium.com/webhint/getting-hints-from-visual-studio-code-69118e48de1b

Slide 57

Slide 57

Create valid app manifests… webhint.io

Slide 58

Slide 58

Fixing your tooling setup… webhint.io

Slide 59

Slide 59

Are you creating inaccessible content? webhint.io

Slide 60

Slide 60

▪ The web is a mess ▪ We are to blame, but often we can’t change what is there ▪ We should not, however, repeat the same mistakes of the past ▪ We have the tooling to apply z accumulated knowledge automatically and be told that we mess up even before we save our code. ▪ This is a great way to learn and will help the future web. In summary… @codepo8

Slide 61

Slide 61

Thanks! Chris Heilmann @codepo8