Brandon Rosage

I create websites and media, united with Ushahidi.

Jan 31, 2012 |

One Web, Many Devices

I’ve linked to Jeremy Keith’s work quite a bit in the short life of this website. His talk in September at the Update conference, “One Web, Many Devices,” embodies why I find his ideas so compelling.

I often find myself reiterating ideas Keith espouses, because they don’t just bang the “long live the web” drum. His message displays a care in our craft that goes beyond just user experience and delightful technology:

But there is another level …where you’re not just thinking about the user right now today and their flow, but where you start to think about all people. Start to think about our species and ask yourself if your creation is going to contribute to the betterment of our species.

I think publishing on the web, there’s a net gain for our species, there’s a net gain for our planet because we’re contributing to the stock as well as the flow. It’s not just for today. It’s for future generations as well.

“One Web, Many Devices” is seminal. Watch, listen or read it.

Jan 9, 2012 |

Fixing iOS' orientation and scale bug

The Filament Group’s Scott Jehl developed and shared a brilliant band aid this week for iOS’ frustrating orientation scaling bug.

The fix arrives via Javascript, which listens to iOS devices’ accelerometer to detect when a user is about to rotate their device. When the script detects an orientation change coming, it temporarily disables user zooming — for only the moment it’s appropriate. User zooming is restored once the device is either oriented close to upright, or after its orientation has changed.

So. Damn. Good.

Recall that web developers have wrestled with iOS in this respect since its launch, wishing to deliver their ‘responsively-designed’ web pages scaled to 100 percent. Using meta name="viewport" content="width=device-width, initial-scale=1.0" allows us to do this.

And it’s been important to deliver this experience to users without invoking maximum-scale=1.0 or user-scaleable=no (which prevents any scaling weirdness) because such a solution creates a whole batch of new problems. The biggest problem it introduces, in my opinion, is stripping users of the common and powerful ability to scale the web page as they see fit.

At the end of the day, we want users that are holding their iPhone in portrait view to see our web pages displayed 320 pixels wide — which they do. But we also want them to be able to rotate their device to landscape view and see the web pages adapt to 480 pixels wide.

Yet Mobile Safari continues to behave differently. When users move from portrait to landscape, our web pages display at a width larger than 480 pixels. Users have to double-tap to bring the scale back down to 100 percent.

See Jeremy Keith demonstrate this behavior, which is strangely gone when viewing web pages in iOS apps’ web view:

I’ve implemented Scott’s fix here on BrandonRosage.com, so you’re welcome to test and sample the behavior here.

Until Apple addresses this bug (or offers a logical reason for Mobile Safari’s behavior), Mr. Jehl is the only person on the planet who can rightfully call Mobile Safari his bitch.

Jan 4, 2012

Deliver content-first HTML without sacrificing a navigation-first layout

One of the best design patterns, in my opinion, to come from the past four years of user interface design on mobile devices is the shift toward displaying content first and navigation second. Having so much less screen real estate than on the desktop has been fantastic for interfaces designed for reading and consuming; though it’s brought tremendous focus to utility apps, too.

But if it’s important in the design of your web product to build a responsive website that doesn’t rely on alternative URLs or subdomains to serve up an entirely new interface, it can be challenging to offer intuitive navigation to desktop users (where it’s displayed at the top of the page) while pushing that navigation to the bottom of the screen for small-screen users.

The brilliant speakers at this summer’s An Event Apart tour, like Luke Wroblewski, Jeremy Keith, Jeffrey Zeldman and Eric Meyer, synthesized some terrific approaches to this problem using nothing but CSS. No browser sniffing, no server-side code.

Smart semantic HTML is, again, rewarded.

There are a few approaches with CSS that address the need to re-order sibling elements. As I tackled this issue in Ushahidi’s SwiftRiver and Crowdmap user interfaces, I begrudgingly settled on the more bulletproof CSS 2.1 solution, ignoring a more elegant CSS3-only solution.

CSS3’s smart solution

Let’s assume I have two primary elements in my document’s body: Content and navigation. My HTML might look like this:

<body>
<div class="content">
<p>My content.</p>
</div>
<nav>
<ul>
<li>Navigation item 1</li>
<li>Navigation item 1</li>
</ul>
</nav>
</body>

By writing our markup first for small-screen devices, we don’t need to do anything out of the ordinary with our CSS here. Content will display first and our navigation will be available after that.

But for larger screens, where we want navigation to appear first, we could target the larger viewport with a CSS media query and insert the following CSS3 properties to reverse their display order:

@media screen and (min-width: 615px) {
    body {
        display: box;
        box-orient: vertical;
        box-direction: reverse;
    }
}

An old school, better-supported solution

The method I used on the control panels for Ushahidi Core and Crowdmap isn’t as intuitive as CSS3’s “box-” properties. But more browsers support it.

Assume the same HTML markup and media query, but leverage different display values and the caption-side property:

@media screen and (min-width: 615px) {
    body {
        display: table;
        caption-side: top;
    }
    nav {
        display: table-caption;
    }
}

The problem this solved on Crowdmap and Ushahidi Core was the need to:

  • Write HTML markup that listed a report’s full story and comments before its metadata (e.g. date, categories).
  • Display a report’s metadata before its full story and comments on large screens.

Crowdmap’s control panel displaying a report’s full story and comments first on a small-screen device

Crowdmap report on iPhone

Crowdmap’s control panel displaying a report’s metadata before its full story and comments on a large-screen device

Crowdmap report on desktop

Jeremy Keith put together a great write-up on these methods, as well as some use cases for leveraging the same CSS properties to display the elements horizontally.

So simple. So powerful.