Archive for the 'accessibility web standards' Category

Reading List

On HTML5 vs Living Standard, W3C vs WHATWG

That nice Stephen Shankland just published a news report HTML5 is done, but two groups still wrestle over Web’s future on CNET, quoting me a couple of times.

As I’m occasionally asked questions about how I see the two different organisations working together (or not), here are the full questions that Steve asked me, and my responses (as approved unchanged by my bosses at Opera). I’m grateful to Steve for giving me his permission to reproduce them.

SS: How big a problem is it that WHATWG and W3C both are sorta kinda in charge?

BL: It’s not an especially big problem for the vast majority of developers who aren’t developing sites using still-fluid features that are only available in the latest nightlies. Where they differ, the W3C spec is a better guide to the stable features as implemented already in browsers – for example, it has dropped the <hgroup> element, warns about the lack of implementations of the outlining algorithm and has much better advice on using the <main> element today to make websites more accessible to people with disabilities.

SS: Which do you think has more power in charting the future of the standard?

BL: Neither. The power is with browser makers. As Ian Hickson of WHATWG said, it doesn’t matter what the specs say if browsers don’t implement them.

SS: It seems kind of like we have two horses pulling the same cart, with no coordination between the horses. Is this a bad use of resources? Or is that a bad metaphor?

BL: The web is the biggest platform we’ve ever had. Therefore, it has more constituencies and competing interests than we’ve ever seen. It’s absolutely right that those different interest groups slug it out. At least it’s (mostly) done openly, unlike the decisions made behind closed doors by proprietary organisations answerable to no-one.

SS: We can’t rewrite history to excise XHTML 2.0, but should the two communities work to converge into one somehow? Is that even possible?

BL: I’d like to see one community , but suspect the cultural clashes are too large. So we have to get along, working together mostly and fighting occasionally, just like a family – albeit sometimes most like the Addams Family.

SS: How much actual real-world confusion is there among developers? Where should they go to see what the “true” spec says?

BL: If you want to see what’s already implemented in browsers now, look at W3C spec. If you want to see what might be coming (or how things may change) look at WHATWG spec.

Opera implements following the WHATWG spec, because that’s where nitty-gritty of the leading-edge stuff is discussed. But we also actively support and participate in the W3C as we see the value in having stable snapshots that developers can refer to, and it’s also the forum for many other vital spec discussions about Web Manifest, Device APIs etc. It’s possible to love both and, as we’re Norwegian, our hearts are full of love for all.

CSS {all: initial} to prevent widgets inheriting CSS from a host page

Imagine you have some sort of widget – an ad box, a sign-up form, some execrable collection of social buttons, whetevs – that you’re injecting into arbitrary pages using JavaScript. You don’t want your widget to get weirdly styled by the host page’s CSS. This is when you want to undo the CSS.

Enter all: initial. This resets all CSS properties to their initial value, and undoes browser stylesheets – in this example, the blockquote is no longer indented or display:block; as you’d expect.

Other values for the property are inherit, which changes all the properties applying to the element or the element’s parent to their parent value, and unset which changes all the properties applying to the element or the element’s parent to their parent value if they are inheritable or to their initial value if not.

They’re supported in Opera, Firefox and Chrome. The Mozilla Developer Network page has good examples of these.

What’s curious, though, is that the value that would be the most useful isn’t there at all. I wouldn’t want to completely strip away User Agent styles and then have to reset elements to display block-level and then indent them in CSS. I wonder why there’s no all: ua-default (or somesuch) to reset them to the User Agent style sheet default?

Update: Saperlipopette! There’s a very good French-language post La cascade CSS avancée: all, initial et unset for those who speak Oohlala.

Reading List

Pointer Events

Microsoft wrote a spec called Pointer Events API that unifies touch, stylus and mouse inputs, and implemented it in IE11 (partially in IE10). Firefox are implementing it too. After initial enthusiasm from Google, Chrome announced that it won’t support it, after all.

  • HTTP 203: Pointer Events – 4 min video in which Jank Architect and Longpoll Lewis explain why Chrome thinks the Pointer Events API smells.
  • Jacob Rossi of Microsoft disputes the claims (G+ link, sorry).
  • More discussion about the Pointer Events Smell video from @SlexAxton, @davemethvin (jQuery): “It all boils down to ‘Why is Chrome+IE+Firefox not enough for Pointer Events, but Chrome+Firefox enough for Touch Events extensions?'”

Other standards ‘n’ shiz

Reading List

Shake your Brucie!

Once in a generation, there is a perfect combination of circumstances that leads to the creation of something truly extraordinary. Today is that day – the flawless union of programming, content, beauty and functionality.

This week at the Future of Web Apps conference, the Stella McCartney of geek crochet, Ruth John, gifted me with a hand-made, individually-designed crocheted mankini. A photo of me wearing it is available on my fashion blog What’s Bruce Wearing Today (caution advised).

At the same conference, Syd Lawrence demonstrated his accelerometer-driven app Shake Her Booty which allows you to control J Lo’s bottom (“booty”) by shaking your phone.

Claudia Snell asked “when can we expect the @brucel version?” so Syd mashed up some video he’d made of me dancing in the mankini at the FOWA after-party, and today has released Shake Your Brucie.

Just tap my booty to begin.

Enjoy.

Why is viewport in a meta tag?

Adam Bradley asked

Marcos Caceres replied

HTML never required an <html>, <head> or <body> element (only XHTML validators did). So if you open test 1 in any browser and view source you’ll see those three elements aren’t in the source. But if you inspect the DOM with any inspection tool, you’ll the browser has inserted those elements.

How does the browser know where to close the <head> and open the <body>? Test 2 shows a page that contains a <vomitingotter> element. This isn’t offcially part of HTML yet (hurry up Hixie!). There is no <body> element in the source, but the browser knew to leave the <title> and <meta charset> in the head and add the <vomitingotter> element into the <body> (which is why you can actually see its contents; by default, no text in the <head> makes its way into the visible page.)

Simply, the first element that isn’t known to be part of the <head> makes the browser close the <head> and open the <body>. So if it’s not recognised as metadata content (<base>, <link>, <meta>, <noscript>, <script>, <style>, <template>, <title>) it goes in the body. Any subsequent “head” elements remain in the <body>; they aren’t restored into the head (see the DOM of test 3), even if you explicitly wrap them in <html>, <head> and <body> elements in the original source – see test 4.

This doesn’t investigate the bigger question of why Apple – who invented the viewport meta tag – decided to add it to HTML at all. After all, HTML is about content and the viewport information is about styling, and would therefore be more appropriately be declared in CSS. I don’t know the answer to that, except that Apple knows best about everything.

There’s a CSS specification called CSS Device Adaptation that is basically “viewport in CSS”, with an @viewport rule (tutorial by Andreas Bovens). This generalises the viewport directive, and gives you more power, too; because it’s in CSS you can combine it with Media Queries. It’s supported in Opera, Chrome and Internet Explorer.

Reading List

Reading List

Reflections on Extensible Web Summit, Berlin

I was lucky enough to visit Berlin very briefly for the Extensible Web Summit. It was organised, it seems, by members of W3C (but was not an officially branded W3C) and hosted by Beuth University, Berlin. Lunch was provided by Google, beers afterwards by Yandex (although I missed those as I’d taken the inexplicable decision to fly back straight after rather than hobnob with the great, the good, and Chaals.) Thanks to all organisations.

This isn’t a record of the day; the event notes were crowd-scribed. It’s my preliminary thoughts about the concept of the “extensible web”.

As far as I can deduce – because the term “extensible web” wasn’t actually defined on the day – it’s about giving/ exposing primitives so developers can extend various parts of the platform. (Read The Extensible Web Manifesto for a longer description and statement of intent.)

In the current world, we wait for something like Appcache to be specified, then implemented and then scoffed at. This can take a long time, and we might not get what we want; Hixie told me “The appcache API is another big mistake. It’s the best example of not understanding the problem before designing a solution … Appcache works great if you want to do what it was designed for, but it turns out most people want to do something different enough that appcache feels horrible to them”.

So, an example of Extensible Web practices/ methodology is Service Worker – it allows you to control how websites fetch and store information across the network (and when there is no network) but it’s very low-level; you have to do everything yourself in JavaScript – but that gives you great power and flexibility.

One of the tests of Service Worker is: can we explain how AppCache works by coding it via Service Worker in JavaScript? Yes, we can. Similarly, Chrome’s Chris Wilson said how he hopes to be able to explain how the <audio> element works in terms of the Web Audio spec. Explaining how things work and giving us hooks in is a good idea, it seems to me. For example, in a sane, Extensible Web-world, we’d never have had the <canvas> element, but instead would have extended <img> with a scriptable API.

But while it’s good to explain magic, I feel we need to be careful about using the word “magic” pejoratively. A lot of the success of the Web was that simple HTML tags (<a>, <input>) made magic happen. You write <img src=”vomiting-otter.jpg”> and a vomiting otter appears; you don’t need to worry about how it gets there over the network, its caching, its format, etc. Similar with <input> – you just code a reasonably obvious word in angle brackets and it works.

As Steve Faulkner notes, a lot of the success of accessibility on the Web is/was that simple HTML elements makes accessibility happen.

Service Workers, and the spec that I’ve been closer to, <picture>, are great examples of listening to developers (partnership). Service Worker came out of a meeting between Opera, Mozilla, Google, BBC, Financial Times etc and was specified by Google, Mozilla and Samsung (and many others). <picture> came about because developers demanded it, even when the browser vendors and standards bodies didn’t care.

The Extensible Web Manifesto says “We prefer to enable feature development and iteration in JavaScript, followed by implementation in browsers and standardization”. I hope the end result is standardisation of a canon of best practice and then native implementation. Although JavaScript and C++ performance are (allegedly) very close now, I’d still rather see Sexy Feature implemented in 20K of C++ in a one-time download of a browser than loads of devs use a different Sexy Feature polyfill that gets downloaded squilions of times by billions of users of millions of sites.

But I’ve already heard potentially good ideas for extensions to core HTML handwaved away with “oh, that’s a job for Web Components”. So I’m not yet entirely convinced that we’re not heralding a new era of JavaScript-only web development. I don’t want to see the fossilisation of the declarative web and a new Programmer Priesthood (re-)emerge.

How can developers make their voices heard? It’s true that browser vendors are OBSESSED with solving developer’s problems. If we don’t, you’ll make native apps, and then browsers disappear, we default on our mortgages, our partners leave us for Apple employees and our hamsters starve. None of us want this to happen. So we try to listen.

Then there is the question of how developers can participate. The bravery barrier to entry for many of the mailing lists is already too high – I periodically get emails from people asking me to propose a feature or ask a question on a list as a proxy because lists are scary places.

W3C has set up a Specification forum where you can ask questions about specs/ propose a feature. Read around it to see if anyone else has a similar proposal, and if appropriate, add comments to that before you set up a new thread. Use Mozilla’s guidelines WebAPI Design Guidelines and please remember that use-cases are much better than a fully-worked out proposed syntax.

I’m enthused about the Extensible Web manifesto and the progress we’ve already made, eg baking popular jQuery-like syntax into browser engines via the Selectors API, getting our hands on the network with Service Worker, and the heady new world of Web Components. We need to ensure that all devs who want to can participate by allowing ease of collaboration, courteous discourse. And it would be perilous to forget that the declarative web reduces the barrier to entry and enhances accessibility.