Tags: i

15416

sparkline

Saturday, July 11th, 2020

A little bit of plain Javascript can do a lot

I decided to implement almost all of the UI by just adding & removing CSS classes, and using CSS transitions if I want to animate a transition.

Yup. It’s remarkable how much can be accomplished with that one DOM scripting pattern.

I was pretty surprised by how much I could get done with just plain JS. I ended up writing about 50 lines of JS to do everything I wanted to do.

Friday, July 10th, 2020

What is CSS Specificity? Sarah Chima - Front-End Developer

An excellent and clear explanation of specificity in CSS.

Picture 1 Picture 2

Out and about in Brighton.

Thursday, July 9th, 2020

Playing The Hag At The Churn (jig) on bouzouki:

https://thesession.org/tunes/829

https://www.youtube.com/watch?v=8jzUUPgzaIU

Replying to

Mr. Show’s pre-taped call-in show. Gets better every time.

https://www.youtube.com/watch?v=mhVbLJvYP8s

Implementors

The latest newsletter from The History Of The Web is a good one: The Browser Engine That Could. It’s all about the history of browsers and more specifically, rendering engines.

Jay quotes from a 1992 email by Tim Berners-Lee when there was real concern about having too many different browsers. But as history played out, the concern shifted to having too few different browsers.

I wrote about this—back when Edge switched to using Chromium—in a post called Unity where I compared it to political parties:

If you have hundreds of different political parties, that’s not ideal. But if you only have one political party, that’s very bad indeed!

I talked about this some more with Brian and Stuart on the Igalia Chats podcast: Web Ecosystem Health (here’s the mp3 file).

In the discussion we dive deeper into the naunces of browser engine diversity; how it’s not the numbers that matter, but representation. The danger with one dominant rendering engine is that it would reflect one dominant set of priorities.

I think we’re starting to see this kind of battle between different sets of priorities playing out in the browser rendering engine landscape.

Webkit published a list of APIs they won’t be implementing in their current form because of security concerns around fingerprinting. Mozilla is taking the same stand. Google is much more gung-ho about implementing those APIs.

I think it’s safe to say that every implementor wants to ship powerful APIs and ensure security and privacy. The issue is with which gets priority. Using the language of principles and priorities, you could crudely encapsulate Apple and Mozilla’s position as:

Privacy, even over capability.

That design principle would pass the reversibility test. In fact, Google’s position might be represented as:

Capability, even over privacy.

I’m not saying Apple and Mozilla don’t value powerful APIs. I’m not saying Google doesn’t value privacy. I’m saying that Google’s priorities are different to Apple’s and Mozilla’s.

Alas, Alex is saying that Apple and Mozilla don’t value capability:

There is a contingent of browser vendors today who do not wish to expand the web platform to cover adjacent use-cases or meaningfully close the relevance gap that the shift to mobile has opened.

That’s very disappointing. It’s a cheap shot. As cheap as saying that, given Google’s business model, Chrome wouldn’t want to expand the web platform to provide better privacy and security.

Wednesday, July 8th, 2020

A tale of three skeuomorphs

A trashcan, a tyepface, and a tactile keyboard. Marcin gets obsessive (as usual).

Replying to

Yes! I can absolutely imagine writing a stylesheet where the only declarations inside media queries are updating custom properties.

Simultaneously nervous and excited as I put the first episode of the @Clearleft podcast live!

https://podcast.clearleft.com/season01/episode01/

It’s about design systems and features @LotteJackson, @PaulRobertLloyd, and @Amy_Hupe.

Design systems on the Clearleft podcast

If you’ve already subscribed to the Clearleft podcast, thank you! The first episode is sliding into your podcast player of choice.

This episode is all about …design systems!

I’m pretty happy with how this one turned out, although as it’s the first one, I’m sure I’ll learn how to do this better. I may end up looking back at this first foray with embarrassment. Still, it’s fairly representative of what you can expect from the rest of the season.

This episode is fairly short. Just under eighteen minutes. That doesn’t mean that other episodes will be the same length. Each episode will be as long (or as short) as it needs to be. Form follows function, or in this case, episode length follows content. Other episodes will be longer. Some might be shorter. It all depends on the narrative.

This flies in the face of accepted wisdom when it comes to podcasting. The watchword that’s repeated again and again for aspiring podcasters is consistency. Release on a consistent schedule and have a consistent length for episodes. I kind of want to go against that advice just out of sheer obstinancy. If I end up releasing episodes on a regular schedule, treat it as coincidence rather than consistency.

There’s not much of me in this episode. And there won’t be much of me in most episodes. I’m just there to thread together the smart soundbites coming from other people. In this episode, the talking heads are my colleagues Jon and James, along with my friends and peers Charlotte, Paul, and Amy (although there’s a Clearleft connection with all of them: Charlotte and Paul used to be Clearlefties, and Amy spoke at Patterns Day and Sofa Conf).

I spoke to each of them for about an hour, but like I said, the entire episode is less than eighteen minutes long. The majority of our conversations ended up on the cutting room floor (possibly to be used in future episodes).

Most of my time was spent on editing. It was painstaking, but rewarding. There’s a real pleasure to be had in juxtaposing two snippets of audio, either because they echo one another or because they completely contradict one another. This episode has a few examples of contradictions, and I think those are my favourite moments.

Needless to say, eighteen minutes was not enough time to cover everything about design systems. Quite the opposite. It’s barely an introduction. This is definitely a topic that I’ll be returning to. Maybe there could even be a whole season on design systems. Let me know what you think.

Oh, and you’ll notice that there’s a transcript for the episode. That’s a no-brainer. I’m a big fan of the spoken word, but it really comes alive when it’s combined with searchable, linkable, accessible text.

Anyway, have a listen and if you’re not already subscribed, pop the RSS feed into your podcast player.

Tuesday, July 7th, 2020

Custom properties

I made the website for the Clearleft podcast last week. The design is mostly lifted straight from the rest of the Clearleft website. The main difference is the masthead. If the browser window is wide enough, there’s a background image on the right hand side.

I mostly added that because I felt like the design was a bit imbalanced without something there. On the home page, it’s a picture of me. Kind of cheesy. But the image can be swapped out. On other pages, there are different photos. All it takes is a different class name on that masthead.

I thought about having the image be completely random (and I still might end up doing this). I’d need to use a bit of JavaScript to choose a class name at random from a list of possible values. Something like this:

var names = ['jeremy','katie','rich','helen','trys','chris'];
var name = names[Math.floor(Math.random() * names.length)];
document.querySelector('.masthead').classList.add(name);

(You could paste that into the dev tools console to see it in action on the podcast site.)

Then I read something completely unrelated. Cassie wrote a fantastic article on her site called Making lil’ me - part 1. In it, she describes how she made the mouse-triggered animation of her avatar in the footer of her home page.

It’s such a well-written technical article. She explains the logic of what she’s doing, and translates that logic into code. Then, after walking you through the native code, she shows how you could use the Greeksock library to achieve the same effect. That’s the way to do it! Instead of saying, “Here’s a library that will save you time—don’t worry about how it works!”, she’s saying “Here’s it works without a library; here’s how it works with a library; now you can make an informed choice about what to use.” It’s a very empowering approach.

Anyway, in the article, Cassie demonstrates how you can use custom properties as a bridge between JavaScript and CSS. JavaScript reads the mouse position and updates some custom properties accordingly. Those same custom properties are used in CSS for positioning. Voila! Now you’ve got the position of an element responding to mouse movements.

That’s what made me think of the code snippet I wrote above to update a class name from JavaScript. I automatically thought of updating a class name because, frankly, that’s how I’ve always done it. I’d say about 90% of the DOM scripting I’ve ever done involves toggling the presence of class values: accordions, fly-out menus, tool-tips, and other progressive disclosure patterns.

That’s fine. But really, I should try to avoid touching the DOM at all. It can have performance implications, possibly triggering unnecessary repaints and reflows.

Now with custom properties, there’s a direct line of communication between JavaScript and CSS. No need to use the HTML as a courier.

This made me realise that I need to be aware of automatically reaching for a solution just because that’s the way I’ve done something in the past. I should step back and think about the more efficient solutions that are possible now.

It also made me realise that “CSS variables” is a very limiting way of thinking about custom properties. The fact that they can be updated in real time—in CSS or JavaScript—makes them much more powerful than, say, Sass variables (which are more like constants).

But I too have been guilty of underselling them. I almost always refer to them as “CSS custom properties” …but a lot of their potential comes from the fact that they’re not confined to CSS. From now on, I’m going to try calling them custom properties, without any qualification.

We need more inclusive web performance metrics | Filament Group, Inc.

Good point. When we talk about perceived performance, the perception in question is almost always visual. We should think more inclusively than that.

Monday, July 6th, 2020

Replying to

Yay! Thank you, Sara!

I’ve been working on this for a while…

May I present …The Clearleft Podcast!

https://podcast.clearleft.com/

Subscribe today—the first episode drops later this week.

It’s going to be a bit different. Hope you like it!

Announcing the Clearleft podcast

I’ve been working on something new for the past few months and now I’d like to share it with you…

The Clearleft Podcast.

Now I know what you’re thinking: aren’t there enough podcasts in the world already? Well, frankly, no. Unless you also concede that there are enough books and records and films in the world already too (to be fair, this is a reasonable thought to have when you’re navigating Amazon, Spotify, and Netflix).

In any case, this podcast is going to be a bit different.

In our field, the usual podcast format is in the form of a conversation: a host or hosts interviewing a guest or guests. Those are great. I’ve certainly enjoyed being the guest on many a great podcast. But I wanted to do something a bit more like an audio documentary.

If you’ve seen a lot of documentaries you’ll know that there are two key factors to getting a great story:

  1. the source material and
  2. the editing.

That’s what makes the Clearleft podcast different.

For the source material, I’ve interviewed my colleagues at Clearleft as well as our peers in other companies. I’ve also gathered great material from conference talks—we’ve got a wealth of wonderful insights from multiple editions of events like UX London, Leading Design, Ampersand, Responsive Day Out, Patterns Day, and dConstruct.

A lot of work has gone into the editing. It probably works out at about an hour of work per minute of podcast. I know that seems excessive, but I really wanted to get a snappy feel for each episode, juxtaposing multiple viewpoints.

The focus of the episode will be around a particular topic rather than a person and will feature lots of different voices woven together. The really challenging part is threading a good narrative. It’s kind of like preparing a conference talk in that respect—I’ve always found the narrative thread to be the hardest but most rewarding part of putting a talk together.

It’s simultaneously exciting and nerve-wracking to put this out into the world. But I think you’re going to enjoy it.

Visit the website for the podcast and choose your preferred method of subscribing. There’s the RSS feed, but the Clearleft podcast is also available on Apple Podcasts, Google Podcasts, Spotify, Stitcher, Deezer, TuneIn, Castro, and Overcast.

The first episode will go live later this week. In the meantime, there’s a short trailer to give you a taste of what’s to come.

The episodes will be grouped together into seasons. I reckon a season will around six episodes long. So you can expect the first season to be released over the next six weeks.

Hope you like it!

podcast.clearleft.com