A place to cache linked articles (think custom and personal wayback machine)
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

pirms 4 gadiem
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. title: Making Sites More Responsive, Responsibly
  2. url: http://24ways.org/2014/making-sites-more-responsive-responsibly/
  3. hash_url: 47212a397c16b892ee6f76fc0e76d535
  4. <p class="lede">With digital projects we’re used to shifting our thinking to align with our target audience. We may undertake research, create personas, identify key tasks, or observe usage patterns, with our findings helping to refine our ongoing creations. A product’s overall experience can make or break its success, and when it comes to defining these experiences our development choices play a huge role alongside more traditional user-focused activities.</p>
  5. <p>The popularisation of responsive web design is a great example of how we are able to shape the web’s direction through using technology to provide better experiences. If we think back to the move from table-based layouts to <span class="caps">CSS</span>, initially our clients often didn’t know or care about the difference in these approaches, but we did. Responsive design was similar in this respect – momentum grew through the web industry choosing to use an approach that we felt would give a better experience, and which was more future-friendly. </p>
  6. <p>We tend to think of responsive design as a means of displaying content appropriately across a range of devices, but the technology and our implementation of it can facilitate much more. A responsive layout not only helps your content work when the newest smartphone comes out, but it also ensures your layout suitably adapts if a visually impaired user drastically changes the size of the text.</p>
  7. <p class="image"><img src="http://media.24ways.org/2014/jenkinson/24waysgrab_cropped.png" alt="Screenshot of the 24 ways site zoomed at 400%"/> <span class="caption">The 24 ways site at 400% on a Retina MacBook Pro displays a layout more typically used for small screens.</span></p>
  8. <p>When we think more broadly, we realise that our technical choices and approaches to implementation can have knock-on effects for the greater good, and beyond our initial target audiences. We can make our experiences <em>more</em> responsive to people’s needs, enhancing their usability and accessibility along the way.</p>
  9. <h2>Being responsibly responsive</h2>
  10. <p>Of course, when we think about being more responsive, there’s a fine line between creating useful functionality and becoming intrusive and overly complex. In the excellent <a href="http://www.abookapart.com/products/responsible-responsive-design"><em>Responsible Responsive Design</em></a>, Scott Jehl states that:</p>
  11. <blockquote>
  12. <p>A responsible responsive design equally considers the following throughout a project:</p>
  13. <ul>
  14. <li>Usability: The way a website’s user interface is presented to the user, and how that UI responds to browsing conditions and user interactions.</li>
  15. <li>Access: The ability for users of all devices, browsers, and assistive technologies to access and understand a site’s features and content.</li>
  16. <li>Sustainability: The ability for the technology driving a site or application to work for devices that exist today and to continue to be usable and accessible to users, devices, and browsers in the future.</li>
  17. <li>Performance: The speed at which a site’s features and content are perceived to be delivered to the user and the efficiency with which they operate within the user interface.</li>
  18. </ul>
  19. </blockquote>
  20. <p>Scott’s book covers these ideas in a lot more detail than I’ll be able to here (put it on your Christmas list if it’s not there already), but for now let’s think a bit more about our roles as digital creators and the power this gives us.</p>
  21. <p>Our choices around technology and the decisions we have to make can be extremely wide-ranging. Solutions will vary hugely depending on the needs of each project, though we can further explore the concept of making our creations more responsive through the use of humble web technologies.</p>
  22. <h2>The power of the web</h2>
  23. <p>We all know that under the HTML5 umbrella are some great new capabilities, including a number of JavaScript <span class="caps">API</span>s such as geolocation, web audio, the file <span class="caps">API</span> and many more. We often use these to enhance the functionality of our sites and apps, to add in new features, or to facilitate device-specific interactions.</p>
  24. <p>You’ll have seen articles with flashy titles such as “Top 5 JavaScript <span class="caps">API</span>s You’ve Never Heard Of!”, which you’ll probably read, think “That’s quite cool”, yet never use in any real work.</p>
  25. <p>There is great potential for technologies like these to be misused, but there are also great prospects for them to be used well to enhance experiences. Let’s have a look at a few examples you may not have considered.</p>
  26. <h3>Offline first</h3>
  27. <p>When we make websites, many of us follow a process which involves user stories – standardised snippets of context explaining who needs what, and why.</p>
  28. <p><em>“As a student I want to pay online for my course so I don’t have to visit the college in person.”</em></p>
  29. <p><em>“As a retailer I want to generate unique product codes so I can manage my stock.”</em></p>
  30. <p>We very often focus heavily on <strong>what</strong> needs doing, but may not consider carefully <strong>how</strong> it will be done. As in Scott’s list, accessibility is extremely important, not only in terms of providing a great experience to users of assistive technologies, but also to make your creation more accessible in the general sense – including under different conditions.</p>
  31. <p>Offline first is yet another ‘first’ methodology (my personal favourite being ‘tea first’), which encourages us to develop so that connectivity itself is an enhancement – letting users continue with tasks even when they’re offline. Despite the rapid growth in public Wi-Fi, if we consider data costs and connectivity in developing countries, our travel habits with planes, underground trains and roaming (or simply if you live in the UK’s signal-barren East Anglian wilderness as I do), then you’ll realise that connectivity isn’t as ubiquitous as our internet-addled brains would make us believe. Take a scenario that I’m sure we’re all familiar with – the digital conference. Your venue may be in a city served by high-speed networks, but after overloading capacity with a full house of hashtag-hungry attendees, each carrying several devices, then everyone’s likely to be offline after all. Wouldn’t it be better if we could do something like this instead?</p>
  32. <ul>
  33. <li>Someone visits our conference website.</li>
  34. <li>On this initial run, some assets may be cached for future use: the conference schedule, the site’s <span class="caps">CSS</span>, photos of the speakers.</li>
  35. <li>When the attendee revisits the site on the day, the page shell loads up from the cache.</li>
  36. <li>If we have cached content (our session timetable, speaker photos or anything else), we can load it directly from the cache. We might then try to update this, or get some new content from the internet, but the conference attendee already has a base experience to use.</li>
  37. <li>If we don’t have something cached already, then we can try grabbing it online.</li>
  38. <li>If for any reason our requests for new content fail (we’re offline), then we can display a pre-cached error message from the initial load, perhaps providing our users with alternative suggestions from what is cached.</li>
  39. </ul>
  40. <p>There are a number of ways we can make something like this, including using the application cache (AppCache) if you’re that way inclined. However, you may want to look into <a href="https://github.com/slightlyoff/ServiceWorker">service workers</a> instead. There are also some great resources on <a href="http://offlinefirst.org/">Offline First!</a> if you’d like to find out more about this.</p>
  41. <p>Building in offline functionality isn’t necessarily about starting offline first, and it’s also perfectly possible to retrofit sites and apps to catch offline scenarios, but this kind of graceful degradation can end up being more complex than if we’d considered it from the start. By treating connectivity as an enhancement, we can improve the experience and provide better performance than we can when waiting to counter failures. Our websites can respond to connectivity and usage scenarios, on top of adapting how we present our content. Thinking in this way can enhance each point in Scott’s criteria.</p>
  42. <p>As I mentioned, this isn’t necessarily the kind of development choice that our clients will ask us for, but it’s one we may decide is simply the right way to build based on our project, enhancing the experience we provide to people, and making it more responsive to their situation.</p>
  43. <h3>Even more accessible</h3>
  44. <p>We’ve looked at accessibility in terms of broadening when we can interact with a website, but what about how? Our user stories and personas are often of limited use. We refer in very general terms to students, retailers, and sometimes just users. What if we have a student whose needs are very different from another student? Can we make our sites even more usable and accessible through our development choices?</p>
  45. <p>Again using JavaScript to illustrate this concept, we can do a lot more with the ways people interact with our websites, and with the feedback we provide, than simply accepting keyboard, mouse and touch inputs and displaying output on a screen.</p>
  46. <h4>Input</h4>
  47. <p>Ambient light detection is one of those features that looks great in simple demos, but which we struggle to put to practical use. It’s not new – many satnav systems automatically change the contrast for driving at night or in tunnels, and our laptops may alter the screen brightness or keyboard backlighting to better adapt to our surroundings. Using web technologies we can adapt our presentation to be better suited to ambient light levels.</p>
  48. <p>If our device has an appropriate light sensor and runs a browser that supports the <span class="caps">API</span>, we can grab the ambient light in units using <a href="http://www.w3.org/TR/ambient-light/">ambient light events</a>, in JavaScript. We may then change our presentation based on different bandings, perhaps like this:</p>
  49. <pre class="language-javascript"><code>window.addEventListener('devicelight', function(e) {
  50. var lux = e.value;
  51. if (lux &lt; 50) {
  52. //Change things for dim light
  53. }
  54. if (lux &gt;= 50 &amp;&amp; lux &lt;= 10000) {
  55. //Change things for normal light
  56. }
  57. if (lux &gt; 10000) {
  58. //Change things for bright light
  59. }
  60. });</code></pre>
  61. <p><a href="http://www.sallyjenkinson.co.uk/labs/fauxluminosity/">Live demo</a> (requires light sensor and <a href="http://caniuse.com/#feat=ambient-light">supported browser</a>).</p>
  62. <p>Soon we may also be able to do such detection through <span class="caps">CSS</span>, with <code>light-level</code> being cited in the <a href="http://dev.w3.org/csswg/mediaqueries4/#mf-environment">Media Queries Level 4 specification</a>. If that becomes the case, it’ll probably look something like this:</p>
  63. <pre class="language-css"><code>@media (light-level: dim) {
  64. /*Change things for dim light*/
  65. }
  66. @media (light-level: normal) {
  67. /*Change things for normal light*/
  68. }
  69. @media (light-level: washed) {
  70. /*Change things for bright light*/
  71. }</code></pre>
  72. <p>While we may be quick to dismiss this kind of detection as being a gimmick, it’s important to consider that apps such as <a href="http://www.everywaretechnologies.com/apps/lightdetector">Light Detector</a>, listed on Apple’s accessibility page, provide important context around exactly this functionality.</p>
  73. <blockquote>
  74. <p>“If you are blind, Light Detector helps you to be more independent in many daily activities. At home, point your iPhone towards the ceiling to understand where the light fixtures are and whether they are switched on. In a room, move the device along the wall to check if there is a window and where it is. You can find out whether the shades are drawn by moving the device up and down.”</p>
  75. <p><cite><a href="http://www.everywaretechnologies.com/apps/lightdetector">everywaretechnologies.com/apps/lightdetector</a></cite></p>
  76. </blockquote>
  77. <p>Input can be about so much more than what we enter through keyboards. Both an ever increasing amount of available sensors and more <span class="caps">API</span>s being supported by the major browsers will allow us to cater for more scenarios and respond to them accordingly. This can be as complex or simple as you need; for instance, while <code>x-webkit-speech</code> has been deprecated, the <a href="https://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html">web speech <span class="caps">API</span></a> is available for a number of browsers, and research into sign language detection is also being performed by organisations such as Microsoft.</p>
  78. <h4>Output</h4>
  79. <p>Web technologies give us some great enhancements around input, allowing us to adapt our experiences accordingly. They also provide us with some nice ways to provide feedback to users.</p>
  80. <p>When we play video games, many of our modern consoles come with the ability to have rumble effects on our controller pads. These are a great example of an enhancement, as they provide a level of feedback that is entirely optional, but which can give a great deal of extra information to the player in the right circumstances, and broaden the scope of our comprehension beyond what we’re seeing and hearing.</p>
  81. <p><a href="http://en.wikipedia.org/wiki/Haptic_technology">Haptic feedback</a> is possible on the web as well. We could use this in any number of responsible applications, such as alerting a user to changes or using different patterns as a communication mechanism. If you find yourself in a pickle, here’s how to print out <span class="caps">SOS</span> in Morse code through the <a href="http://www.w3.org/TR/vibration/">vibration <span class="caps">API</span></a>. The following code indicates the length of vibration in milliseconds, interspersed by pauses in milliseconds.</p>
  82. <pre class="language-javascript"><code>navigator.vibrate([100, 300, 100, 300, 100, 300, 600, 300, 600, 300, 600, 300, 100, 300, 100, 300, 100]);</code></pre>
  83. <p><a href="http://www.sallyjenkinson.co.uk/labs/vibration/">Live demo</a> (requires <a href="http://caniuse.com/#feat=vibration">supported browser</a>)</p>
  84. <h2>With great power…</h2>
  85. <p>What you’ve no doubt come to realise by now is that these are just more examples of progressive enhancement, whose inclusion will provide a better experience if the capabilities are available, but which we should not rely on. This idea isn’t new, but the most important thing to remember, and what I would like you to take away from this article, is that it is up to us to decide to include these kind of approaches within our projects – if we don’t root for them, they probably won’t happen. This is where our professional responsibility comes in.</p>
  86. <p>We won’t necessarily be asked to implement solutions for the scenarios above, but they illustrate how we can help to push the boundaries of experiences. Maybe we’ll have to switch our thinking about how we build, but we can create more usable products for a diverse range of people and usage scenarios through the choices we make around technology. Let’s stop thinking simply in terms of features inside a narrow view of our target users, and work out how we can extend these to cater for a wider set of situations.</p>
  87. <p>When you plan your next digital project, consider the power of the web and the enhancements we can use, and try to make your projects even more responsive and responsible.</p>