Archive

March 2, 2024
Every client theme I build uses a base theme, but it's not always the same base theme and for various reasons they don't always have the same breakpoints. I've always been a little bit bothered by having to duplicate breakpoints in JavaScript because it feels redundant and a potential source of future issues / inconsistency—on multiple occasions I've inherited sites where the breakpoints aren't consistent across CSS and JavaScript, leading to unexpected behaviour at certain browser widths. My solution to this has been to start including the breakpoints as JSON in the HTML source so that any JavaScript that needs them can find them there rather than having them hardcoded in the script itself.
October 8, 2023
I've always been extremely pedantic about checking that things exist before trying to use them. Recently, thanks in part to some new features available in PHP 8+, I've learned that it's possible to write much more concise code that's equally robust.
Tags
June 15, 2023

Drupal's default RSS feed is bizarrely difficult to tame. There are a few issues with it, but the biggest one is the fact that each item's description has a link to the author's user profile appended to it in such a way that it can't be removed by any normal means—since user profile pages are not public for the vast majority of Drupal sites I build, this means there's effectively a link to a 403 error page in each RSS item.

Tags
June 3, 2023

Drupal's core “Manage display” functionality provides the option to link images to content, which is handy for, e.g., teasers. If the link contains nothing but an image, however, some accessibility checkers will (rightly) flag these links because there's no textual information indicating where they're going. One solution is to add a title attribute to the link.