Showing posts with label information architecture. Show all posts
Showing posts with label information architecture. Show all posts

Monday, May 12, 2014

Responsive Design Begins With The URL

via Smashing Magazine http://ift.tt/Rbo5n6

The BBC’s Programmes website is huge, and is intended to be a rolling archive of everything that the BBC broadcasts on television and radio. Originally released in 2007, it now has pages for over 1.6 million episodes, but that’s barely half of the story. Surrounding those episodes is a wealth of content, including clips, galleries, episode guides, character profiles and much more, plus Programme’s newly responsive home pages.
The new responsive home pages, known as “brand” pages, join the schedule and A–Z lists in a broader responsive rebuild. 39% of users (and growing) now use mobile and tablet devices to visit these pages; so, making the pages responsive was the best way to serve a great experience to everybody while keeping the website maintainable.
This article is a case study of the responsive rebuild of the BBC’s Programmes pages, and it actually begins back in 2007, at the conception of the project.

URLs

The core principle in creating a potentially enormous website that will last forever is to get the information architecture right in the first place. This involves knowing your data objects and how they fit together. It should also determine the URL structure, which for Programmes is the most important aspect. Take the URL for Top Gear’s home page:

http://www.bbc.co.uk/programmes/b006mj59

After the domain name comes the word “programmes,” which is a simple, unchanging English word. It is intended to describe the object, and is not a brand or product name. Plurals are used so that the URL can be hacked backwards to retrieve an index.
Next is the programme identifier. Note the lack of hierarchy and the lack of a title. Titles change over time, and many programmes do not have a unique title, which would cause a clash. Hierarchies also change — a one-off pilot could be commissioned for a full series. Understanding your objects allows you to recognize what is permanent. In this case, nothing is particularly guaranteed to be permanent, so a simple ID is used instead. Users aren’t expected to type these URLs, though. They will usually arrive through a search engine or by typing in a friendly redirect that has been read out on air, such as bbc.co.uk/topgear. But the key principle of a permanent URL is that inward links are trusted to be shareable and work forever. Cool URIs don’t change.
A clear information architecture defines the URL scheme. A piece of content is given a clear canonical home, where appropriate. Links and aggregations between them then clearly appear.
A clear information architecture defines the URL scheme.
A clear information architecture defines the URL scheme. (Large preview)
It is clear how the data will be sliced before any wireframes are drawn or code is written. The black lines are direct links, while the red lines are shortcuts that we’ll add later.
On the brand page, we display the following information about the programme:
  • Summary (image and synopsis)
  • Can the user watch or listen to it now?
  • When will it be on TV or the radio?
  • How does one buy it?
  • Clips from the programme
  • Galleries from the programme
  • Editorially curated links to content (promotions)
  • Textual supporting content
  • Related links
This is a lot of content for a responsive page. Page loading could become excessive on low-end devices, so a priority needs to be determined.
Loading priority should be determined for sites with large amounts of content.
Loading priority should be determined for sites with large amounts of content. (Large preview)
Content is king, so hiding it on smaller screens is not acceptable. If any content could be sacrificed on mobile, then question whether it truly belongs on the desktop to begin with. The user journey remains the same, regardless of the device being used.
However, even though content may not be sacrificed on mobile, it doesn’t have to be present in its full form all the time. A simple link to the content might suffice, and because we have already defined a URL structure, most of the content already has somewhere to link to. Therefore, the block of “clips” on the brand page will, by default, link to this:
/programmes/:id/clips    
This is Web-friendly and the minimum viable product. If no more work was done, we’d still have something that works. The next phase is to see whether any enhancement can be made. We can use JavaScript to determine screen size (and possibly other factors) and then decide whether to load some shortcuts. By default, just a link is shown, but with enough space and if JavaScript is available, the link would be replaced with a carousel of the first six clips. These first six are the same six from /clips; this lazy-loaded content is simply a shortcut (the red lines from earlier).
Different states of lazy loading content.
Different states of lazy loading content. (Large preview)
JavaScript can be used to lazy-load content fairly often, but we have rules:
  • It may not be used for core content or for the user journey of the page.
  • It may be used only where a URL exists for the content, never for href="#".
The top area of the page (which shows what the object is and how to watch it) is the core user journey of the brand page, so it is not lazy-loaded. Clips, galleries and recommendations are lazy-loaded, but promotions are not because they do not have URLs of their own. You could argue that promotions could be surfaced at the following URL:
/programmes/:pid/promotions    
But promos are not really “consumable content.” A user wouldn’t click a link to see all promos in this context, so promos are not lazy-loaded.

Images

Images are always a challenge in responsive Web design, and they were for us, too. Some of ourlong aggregation pages contain a lot of images, which need to be displayed at sizes appropriate to the device. The total download size of these long pages can be over 1 MB, mostly due to the images.
Therefore, we decided to tackle images in the same way that we tackle content, by asking whether a given page is the canonical home of the image. If it is, then the image must be there. If it isn’t, such as on the aggregation pages, then the image isn’t there by default. We then load in the most appropriate-sized image for the container with JavaScript. Additionally, only images currently in the viewport are loaded. As the page is scrolled, images that are about to appear are pulled in. This technique saves a lot of bandwidth on initial page loading, vastly improving response times for users, especially on small devices and when the user doesn’t scroll far. A useful library that uses a similar technique is used on BBC’s responsive News pages and is available in the open-source Imager.js.
At first, the implementation of this technique made the page jump around a lot as the user scrolled down and the images appeared. To work around this when the page first loads and the JavaScript kicks in, we load an old-fashioned spacer PNG, which has a 16:9 ratio and occupies the spaces of the images that will be filled in later. This is one extra download request for a small file that is used throughout the page. Using an inline base64-encoded PNG might have been preferable, but we discovered that Windows Phone devices do not display the holding image in the correct ratio, rendering it as a 1:1 square, so we had to use a standard PNG.
The techniques so far suggest a lot of use of JavaScript. This is true because it is loaded and runs on every page, but it is used with a light touch. JavaScript is not a requirement for any page(except for the playback of media), and it doesn’t do any particularly heavy lifting. Lazy-loaded content calls a .inc partial URL, which returns HTML that is simply dropped into the page. The JavaScript barely does any DOM construction because the elements are constructed by server-side code, reusing the same partials.
Templating frameworks such as Handlebars could construct the DOM elements from a JSON source, but why fight the pre-parser? Browsers are extremely efficient at parsing and rendering HTML quickly, so we wouldn’t add complexity for such a simple use case. The website works and is stable without JavaScript — no need to overdo it.

CSS

Building a large website that is maintainable requires a CSS strategy, or else it would balloon out of proportion. We decided to follow the BEM methodology to create reusable blocks of CSS. The blocks might be granular and generic (for typography and grids) or more modular (for whole objects). The CSS is built up from Programmes’ style guide
04-programme-object-500
An example of BBC’s programm styleguide. (Large preview)
This is the Programmes object. It is a server-side-generated partial and is used in multiple locations around the website. It has several variations, depending on the container that it needs to go in or the content that is available at a given time. The options are demonstrated on the corresponding page of the style guide, where they can be built and tested, ready to be dropped (hopefully) flawlessly anywhere in the application.
This method of building reusable CSS gives rise to some extra markup in the page, with some particularly long examples:
<div class="grid bpw2-thirteen-twentyfourths bpe-thirteen-twentyfourths grid--bounded">
However, because these are generated by server-side code, they are usually easily updatable. These blocks tend to be repeated throughout the page, but Gzip compresses the markup extremely well. This CSS framework makes for a very reusable system. Programmes’ global.cssfile is included on every page and handles everything related to layout, all at just 15.4 KB (after Gzip’ing), which speeds up the creation of new pages. We can throw together some simple list-based pages, such as recommendations, within minutes, without having to write any new CSS and by reusing the same Programmes object partial. This also enforces consistency across pages.
All objects are built to be touch-first, but not touch-dependent. The stream, which can be seen on the season page, has an overflowing div in order to support native scrolling and automatic touch capabilities. However the arrow buttons (note not <a> tags) are still present for old devices and for people who wish to use a keyboard and mouse. The detection of touch does not necessarily mean that the user is touching to navigate, so mouse hovering is always supported.
Touch-first also means large hit areas. The Programmes object above has an overlaid link to make the whole object clickable, even though it will sometimes have multiple links within it.
After we launched this feature, we were informed by a user that in Windows high-contrast mode, all Programmes objects disappeared. We discovered that in high-contrast mode, Internet Explorer 9 forces the background of all links to be solid black, effectively obscuring the object. To overcome this across the board, we had to force the background color to be transparent with RGBa, and we set the opacity of the overlaid link to 0, which allowed the object underneath to show through.
.block-link__overlay-link {
   top: 0;
   right: 0;
   bottom: 0;
   left: 0;
   overflow: hidden;
   text-indent: 200%;
   white-space: nowrap;
   background: rgba(0, 0, 0, 0); // IE 9 fix
}

// Increased specificity so that it trumps ".block-link a"
a.block-link__overlay-link {
   position: absolute;
   z-index: 0;
   // The next line is needed because all elements have a solid-black
   // background in high-contrast mode
   opacity: 0;
}
At present, the BBC still receives a lot of traffic from Internet Explorer 8, which does not support media queries. We had to decide, then, what to show these users. The first option would be just to show the mobile version of the website to them, suitably scaled up but with nothing complex happening. This was not acceptable as the usage numbers are still too high, especially among the editorial staff. Therefore, we came up with a workaround.
We build our CSS using Sass, which fits very well with the modular structure, allowing partials to be organized in a clear folder structure. Wherever we use media queries, we can abstract them into breakpoints using Sass and then name them. In our main file, we then decide which breakpoints to pull in and whether to wrap them in media queries. The Sass component for handling this is available as Breakup. This means we can have two files: global.css and global-ie.css. The global-ie.css file gets all of the base and desktop breakpoints, without media queries, meaning that it is a fixed 1008-pixel page. We then decide which CSS to serve using IE conditional comments:
<!--[if (gt IE 8)|!(IE)]><!-->
        <link rel="stylesheet" href=”path/to/styles/global.css" /><!-- Also contains print -->
    <!--<![endif]-->
    <!--[if (lt IE 9)&(!IEMobile)]>
        <link rel="stylesheet" href="path/to/styles/global-ie.css" />
        <link rel="stylesheet" href="path/to/styles/print.css" media="print" />
    <![endif]-->
It also extends to the print CSS, because we can wrap that in media queries for newer browsers, too, which saves an extra download.

Limitations

Our responsive design still has a few limitations in its capabilities. We are keen to see a native solution for element queries to fix a few minor icon-sizing issues without the need for polyfills. At the moment, we can only make decisions based on the whole window size.
Roughly same-sized images should ideally get the same-sized icons.
Roughly same-sized images should ideally get the same-sized icons.
There are also a few situations in which the markup order isn’t ideal on all devices. Improvements such as CSS grid layout will enable us to interlace modules at different screen sizes.

Conclusion

By building a website on which the content is king, starting with a clear information architecture and well-defined URLs, we have built a framework that we are proud to maintain. Using a sound URL scheme and building pages with semantic markup give us many benefits for free (or at least partially for free):
  • permanence,
  • stability,
  • optimization for search engines (linkability),
  • accessibility,
  • shareability.
By progressively enhancing, we could still build an interface that is attractive and information-dense where appropriate. We will continue to adapt with new responsive features as they become available and once visits from old browsers decline enough that we can move ahead. Reusable content components and CSS make that easier to do, thus making it possible to look after such a large website as it continues to grow every day.
(al, ml)

Sunday, December 15, 2013

Collapsible header sections — more problematic than helpful

via I'd Rather Be Writing: Technical writing blog -- tips for technical writers http://idratherbewriting.com/2013/12/11/collapsible-header-sections-more-problematic-than-helpful/

I’m a flip-flopper when it comes to collapsible sections. Sometimes I think they’re great, and other times I think they’re problematic.
A while ago I converted nearly all of my help’s subheadings into collapsible sections. I trend toward longer help pages, and the collapsible heading sections seemed like a natural way to provide a kind of clickable TOC. Readers could see up-front all the sections on the page and go directly to the section they needed. No need to scroll and scroll. Collapsible sections, it seemed, provided a way to reduce long pages into a more usable form.
And so I went about collapsing my heading sections. That’s when I started noticing how problematic collapsible sections get.

Problem #1: Pages get too long

If you can collapse your heading sections, your pages can get really long because you can just keep adding more and more sections without feeling like the page is too massive.
This may seem cool at first, since it means you can reduce the overall number of pages in your help material considerably. You can potentially reduce the unique page count to a third of the normal size, without forcing readers to look at infinitely scrollable pages.
However, long pages are often harder to manage. There comes a point when there’s simply too much information on one page. The human mind does a better job processing information when the information is divided into smaller chunks (to an extent — the chunks can’t be too small or you lose context).
For me, a good page size is anywhere between about 500 and 1,500 words or so. But when you start hitting the 2,000 + word count range, it doesn’t seem to work as a regular web page.
If you make your pages shorter, the need for collapsing sections decreases. Some topics may be only 300 to 600 words long. For those pages, do you still collapse the section headings? It looks silly if you do, and inconsistent if you don’t.
This pretty much sums up the problem. Shorter pages don’t need collapsible sections. The majority of tech writers create help in short topics rather than long topics (often because they’re single sourcing), so that’s why you rarely see collapsible sections used in help material — short pages just don’t need them.

Problem #2: Where to start collapsing

Another problem with collapsible headings is figuring out where to start collapsing them. If you have an introductory paragraph on your page, following by maybe 5 or 6 subheadings, most likely you’d just start collapsing each subheading.
But if that introductory paragraph is rather short, maybe 1-2 sentences, the page looks mostly blank. You have all of this empty space due to the collapsed headings.
This is not to say that another style technique that uses collapsible sections couldn’t be successful. Check out this help page from Google called Using Keyword Planner to get keyword ideas and traffic estimates. Here the author decided to collapse only tasks.
Collapsed sections in Google's Adwords help
The collapsed sections don’t leave the page looking empty. In fact, they do a pretty good job at reducing the page size in a reader-friendly way.
But I wonder how this strategy works across an entire help site. Are all lists collapsed, or just some lists on pages that seem long? What if the page consists primarily of task steps and not concepts?If the collapsing is done in a mostly arbitrary way, isn’t that inconsistency going to create confusion for readers, who will wonder why some sections are collapsed while others aren’t?

Problem #3: Loss of immediate scannability

As a reader, I like to generally scan a page without having to manually click buttons to reveal the text. Although it can be nice to pick and choose what parts of the page I want to see, more often than not, I don’t want to be burdened by opening up every single section I want to see. When you collapse heading sections, you force readers to do a lot more work just to read the page.
For example, here’s the welcome page for Flare’s help. Lots of sections are collapsed.
collapsed sections in Madcap Flare help
This might be a good thing, since you can go directly to the section you want. But it also means you have to click the page repeatedly just to see what each section contains.
Collapsing sections like this requires the subheadings to be more precise and clear. The subheadings need to do a stellar job at telling me exactly what’s in the section. That way I won’t have to guess with each click, wondering what information it contains.
I have to confess that when my collapsed subheadings are stacked like this, they’re a lot less clear. At least when subheadings aren’t collapsed, they also serve as a welcome break and pause for the reader, regardless of what the words actually say.

Problem #4: Linking

Linking may seem like a problem only inherent in the collapsible technique I was using, but since our help is on Drupal, we implemented the Collapse Text module. You can roll your own expand/collapse code, like I did here at Sample Expand and Collapse Code with Twisting Buttons, but using the existing module was simply easier (at first).
It turns out that for each section you want to collapse, you have to format it like this:
1
2
3
4
5
[collapsed title="This is the collapsed title"]
 
Here's the content that gets collapsed....
 
[/collapse]
Now, what happens when you want to link to this section? Can you add an ID value to the link? No, the module chokes on it. You have to add an empty style tag with an ID inside the collapsed section.
1
2
[collapsed title="Rules for custom attributes"]
<a id="rules-attributes"></a>
The section opens automatically when the user goes to this spot, but since the ID is below the actual title, the title is slightly out of sight in the browser window.
The only workaround is to use a special class that offsets the position, like this:
1
2
3
4
a.anchor {
        position: relative;
        top: -30px;
    }
When a user clicks a link with this class, the user’s position gets offset 30 pixels at the top. To use this class in the context of the module, your links end up looking like this:
1
2
[collapsed title="Rules for custom attributes"]
<a class="anchor" id="rules-attributes"></a>
It’s just kind of crappy kluge-like code. Most likely another write would come along, assume a wysiwyg editor inserted this jargon, and delete it.
While I mentioned wysiwyg, if you flip into your wysiwyg view, all of these heading titles are hard to find, because the wysiwyg editor only recognizes the heading tags (such as h2).
I haven’t even mentioned the blow to SEO that happens when you strip out your h2 tags and replace them with bracketed material. The brackets are actually shortcodes that get converted to HTML when you view the page in the browser. So the final code looks like this:
1
<fieldset class="collapse-text-fieldset collapsible collapsed form-wrapper"> <legend><span class="fieldset-legend">Sample Collapsed section</span> </legend><div class="fieldset-wrapper"> <div class="collapse-text-text">
Try styling that. You’ll be hitting Inspect Element for quite a while just trying to figure out what controls what.
To be fair, the module author probably didn’t intend to use this technique with headings, but that’s how I was using it. I only note all this to show that what seems fairly simple gets much more complicated as you work out the details.
In retrospect, if implementing collapsible sections, use the jQuery technique I referenced earlier and apply it to an existing style. Then you can turn the collapsed sections on or off almost instantly.

Problem #5: Searches

A final problem is with search results. If a user searches for a keyword contained in the collapsed sections, the sections don’t expand to show the reader where the keyword is. The reader would need to expand each section on the page to figure out where the keyword is on the page.
This becomes rather tedious for the reader, so you might think oh, let’s just put an Expand All button and Collapse All button on the page. This functionality isn’t included in the Drupal module by default, so again, you have to either roll your own (discarding the module), or expand the module’s functionality.
Then, assuming you get the thing working, you have to decide whether you’ll include the Expand / Collapse buttons on every page by default or only on select pages. You’ll no doubt want it on select pages, because you certainly don’t want Expand / Collapse buttons on pages where there aren’t any collapsed sections.
To add the buttons selectively on the page, you’ll need to define a style element and add some jQuery to trigger a script when the element is clicked. This means more scripts and more styles, adding to your loading page’s loading time. Not a huge deal here, but it’s more hassle. (I actually have no idea how to automatically expand a specific collapsed section that contains a keyword on a search results page.)
Is all of this extra programming worth it? I don’t think so.

A better solution

Although I’ve pointed out a lot of the problems with collapsible sections (both technical problems and with usability), collapsible sections could come in handy in places. I do like how Google has used collapsible sections to shrink various lists on the page. But ultimately I decided that a table of contents feature on the top (automated based on h2 tags) is a better solution.
automatic table of contents on pages
With the table of contents method, the page is long but the reader can easily jump to the right section. This model offers both scannability and selectability. You can see a demo page hereon a test Drupal site I’m playing with (leveraging the TOC Filter module). Readers are already familiar with this model because it’s the same model Wikipedia uses.