
Checked in at Brighton. On the beach — with Jessica
Checked in at Brighton. On the beach — with Jessica
Prompted by my recent post on alt
text, Geoff shares some resources on the right length for alt
attributes.
Checked in at The Lord Nelson Inn. Thursday night session ☘️🎶
Having an espresso martini and some BBQ on the roof of the @Clearleft HQ with my mate @clagnut to celebrate his 50th birthday!
Checked in at Jolly Brewer. Playing tunes! — with Jessica
I made the website for this year’s UX London by hand.
Well, that’s not entirely true. There’s exactly one build tool involved. I’m using Sergey to include global elements—the header and footer—something that’s still not possible in HTML.
So it’s minium viable static site generation rather than actual static files. It’s still very hands-on though and I enjoy that a lot; editing HTML and CSS directly without intermediary tools.
When I update the site, it’s usually to add a new speaker to the line-up (well, not any more now that the line up is complete). That involves marking up their bio and talk description. I also create a couple of different sized versions of their headshot to use with srcset
. And of course I write an alt
attribute to accompany that image.
By the way, Jake has an excellent article on writing alt
text that uses the specific example of a conference site. It raises some very thought-provoking questions.
I enjoy writing alt
text. I recently described how I updated my posting interface here on my own site to put a textarea
for alt
text front and centre for my notes with photos. Since then I’ve been enjoying the creative challenge of writing useful—but also evocative—alt
text.
Some recent examples:
A close-up of a microphone in a practice room. In the background, a guitar player tunes up and a bass player waits to start.
People sitting around in the dappled sunshine on the green grass in a park with the distinctive Indian-inspired architecture of the Brighton Pavilion in the background, all under a clear blue sky.
Looking down on the crispy browned duck leg contrasting with the white beans, all with pieces of green fried herbs scattered throughout.
But when I was writing the alt
text for the headshots on the UX London site, I started to feel a little disheartened. The more speakers were added to the line-up, the more I felt like I was repeating myself with the alt
text. After a while they all seemed to be some variation on “This person looking at the camera, smiling” with maybe some detail on their hair or clothing.
The beaming bearded face of Videha standing in front of the beautiful landscape of a riverbank.
Candi working on her laptop, looking at the camera with a smile.
Emma smiling against a yellow background. She’s wearing glasses and has long straight hair.
A monochrome portrait of John with a wry smile on his face, wearing a black turtleneck in the clichéd design tradition.
Laura smiling, wearing a chartreuse coloured top.
A profile shot of Adekunle wearing a jacket and baseball cap standing outside.
The more speakers were added to the line-up, the harder I found it not to repeat myself. I wondered if this was all going to sound very same-y to anyone hearing them read aloud.
But then I realised, “Wait …these are kind of same-y images.”
By the very nature of the images—headshots of speakers—there wasn’t ever going to be that much visual variation. The experience of a sighted person looking at a page full of speakers is that after a while the images kind of blend together. So if the alt
text also starts to sound a bit repetitive after a while, maybe that’s not such a bad thing. A screen reader user would be getting an equivalent experience.
That doesn’t mean it’s okay to have the same alt
text for each image—they are all still different. But after I had that realisation I stopped being too hard on myself if I couldn’t come up with a completely new and original way to write the alt
text.
And, I remind myself, writing alt
text is like any other kind of writing. The more you do it, the better you get.
Duck leg on white beans with sage, garlic, rosemary and olives.
I’ve got the same hunch as Nolan:
There’s a feeling in the air. A zeitgeist. SPAs are no longer the cool kids they once were 10 years ago.
And I think he’s right to frame the appeal of single page apps in terms of control (even if that control comes at the expense of performance and first-load user experience).
Salad Niçoise on a nice warm evening.
Checked in at The Bugle Inn. Sunday session — with Jessica
Checked in at Haus On The Hill. Sunday roast — with Jessica
Playing tunes.
I added a “notes” section to this website eight years ago. I set it up so that notes could be syndicated to Twitter. Ever since then, that’s the only way I post to Twitter.
A few months later I added photos to my notes. Again, this would get syndicated to Twitter.
Something’s bothered me for a long time though. I initially thought that if I posted a photo, then the accompanying text would serve as a decription of the image. It could effectively act as the alt
text for the image, I thought. But in practice it didn’t work out that way. The text was often a commentary on the image, which isn’t the same as a description of the contents.
I needed a way to store alt
text for images. To make it more complicated, it was possible for one note to have multiple images. So even though a note was one line in my database, I somehow needed a separate string of text with the description of each image in a single note.
I eventually settled on using the file system instead of the database. The images themselves are stored in separate folders, so I figured I could have an accompanying alt.txt
file in each folder.
Take this note from yesterday as an example. Different sizes of the image are stored in the folder /images/uploaded/19077
. Here’s a small version of the image and here’s the original. In that same folder is the alt
text.
This means I’m reading a file every time I need the alt
text instead of reading from a database, which probably isn’t the most performant way of doing it, but it seems to be working okay.
Here’s another example:
In order to add the alt
text to the image, I needed to update my posting interface. By default it’s a little textarea
, followed by a file upload input
, followed by a toggle (a checkbox under the hood) to choose whether or not to syndicate the note to Twitter.
The interface now updates automatically as soon as I use that input type="file"
to choose any images for the note. Using the FileReader
API, I show a preview of the selected images right after the file input.
Here’s the code if you ever need to do something similar. I’ve abstracted it somewhat in that gist—you should be able to drop it into any page that includes input type="file" accept="image/*"
and it will automatically generate the previews.
I was pleasantly surprised at how easy this was. The FileReader
API worked just as expected without any gotchas. I think I always assumed that this would be quite complex to do because once upon a time, it was quite complex (or impossible) to do. But now it’s wonderfully straightforward. Story of the web.
My own version of the script does a little bit more; it also generates another little textarea
right after each image preview, which is where I write the accompanying alt
text.
I’ve also updated my server-side script that handles the syndication to Twitter. I’m using the /media/metadata/create
method to provide the alt
text. But for some reason it’s not working. I can’t figure out why. I’ll keep working on it.
In the meantime, if you’re looking at an image I’ve posted on Twitter and you’re judging me for its lack of alt
text, my apologies. But each tweet of mine includes a link back to the original note on this site and you will most definitely find the alt
text for the image there.
Checked in at Vine Street Tap. Daydrinking — with Jessica
Brighton in the sun.
Time to go play some songs with @SalterCane.
Watching the livestream of @KLBouman introducing us to @EHTelescope’s image of Sagittarius A*—amazing!
Playing tunes.
Checked in at Baker Street Coffee. Flat whites — with Jessica
An opinionated blog about writing. I’ve subscribed in my feed reader.