Elon’s Twitter finally does something right

I joined Twitter in 2009, and over the span of a decade amassed over 40,000 tweets (and just over 500 followers, most of whom I believe were real humans, as I actively culled the obvious bots during my Twitter heyday). But when, around 2015, the site became a platform for would-be fascist authoritarians, I began to lose interest. I pretty much left entirely in 2017, and after a brief re-emergence in 2019 (which only served to confirm that the place was a rage machine hellscape I was better off avoiding), I decided to delete my account entirely.

But for some reason, the Twitter of 2019 labeled my closed account as suspended — with their standard message about violating terms of use. Absolutely false. And while I was briefly outraged, I eventually saw it as a badge of honor. Twitter was an apocalyptic dumpster fire long before Elon Musk was forced to buy it, and I became almost proud to have people think I had been kicked out against my will.

Periodically over the past 3 1/2 years I’ve gone back and looked at my account page to see if it still said I had been suspended, which it did. Until now. I just checked it today, and at some point in the last month or two, since I last checked it, my account page has — finally? — been updated to the correct status:

More Gutenberg madness (“This block has encountered an error and cannot be previewed”)

The WordPress Gutenberg project (a.k.a. the Block Editor) is supposed to make building WordPress sites faster and… well… once you get the hang of it, that often is the case. Recently I’ve actually marveled at how quickly it has allowed me to build out a site, now that my base theme is getting a bit more polished. And creating block patterns in WordPress 6 is super slick, after you learn a few of its quirks.

But then, the Block Editor will throw me a curveball that can derail things for days. For instance, there’s this:

I have a site using my custom theme that all of a sudden started throwing out this message after a recent update. It’s on the Separator block (a.k.a. a glorified <hr> tag). I took a look at the code, and there’s nothing overly complicated going on. The best clue I had to the problem was that it may have something to do with the .has-alpha-channel-opacity CSS class getting applied to the tag.

Then I noticed that in a child theme I’m building for another site, the error didn’t occur. I tried switching between the child theme and parent theme, and sure enough — with the parent theme, I get the error; with the child theme, I don’t. So… what is it?

Well… with almost any type of problem solving, it’s about trial and error, finding differences, ruling things out, and narrowing your search. But it was really hard to find anything between the parent theme and child theme that might cause this. Certainly there were no differences in how they treat Separator blocks.

I came back to that CSS class. Why is that there? Where Gutenberg is concerned, when in doubt, it’s always a good idea to have a look at the theme.json file. And, sure enough, that’s where the difference was. In my parent theme, I had this (note line 13):


But in the child theme, I had this:


Yes, for some reason, an empty array for the color.gradients setting allows the Block Editor to properly parse the Separator block, but a null value causes the error.

WHY???

I don’t know. I don’t really care. At least I was able to fix it. But this again makes me question the wisdom of the entire Gutenberg enterprise. I still don’t really buy the rationale that this JSON file is the way to go, although I am at least starting to understand why it was chosen. However I think this example illustrates some of the negatives of the approach.

“The Cloud” is faster than any external hard drive

I have a lot of data. I mean a LOT of data. Between client files, photos, my own music and video projects, and just ~30 years of accumulated digital stuff we’re talking many, many terabytes. I don’t think we can quite get into thinking in terms of petabytes, but it’s on the horizon.

Keeping backups of all of that data is tedious. Companies like Apple, Google, and Microsoft — not to mention OS-independent third-party vendors like Dropbox — are encouraging us to keep all of our data in “the cloud.” While there are various business advantages for them in us doing that — monthly subscription revenue, of course, plus the ability to (to some extent, at least) sic their algorithms on our masses of data for training their AI models or shoving targeted advertising in our faces — there also are advantages for us.

The main advantage that these companies tout is our ability to access our data from any of our devices, anywhere in the world. But if you’ve spent any time trying to read or write data on an external HDD attached to your computer, you’ve likely noticed another difference. Hard disks are SLOW. SSDs are better, but still not that fast. Consumer-grade drives, even the best ones, definitely are not as fast as the industrial-grade, super-optimized drives filling these companies’ cloud data centers.

But here’s the really key point: as people’s Internet bandwidth improves, we’re getting to a point where there is no bottleneck in the cloud drive interface comparable to the severe limitations of transfer speed on external hard disks. With gigabit fiber in my home, it is way faster for me to access data on my iCloud Drive than on the WD Elements disk I have sitting right on my desk. And, given the failure rate of these kinds of disks — and the huge risk of corruption if you just, you know, unplug it at the wrong moment — a local external hard disk is becoming increasingly unviable as a method of archiving one’s data.

I currently have four sluggish 5 TB HDDs in my desk drawer, another one hooked up regularly as my TimeMachine drive, plus a 2 TB SSD that exists solely for situations when I’ve filled up my MacBook Pro’s internal 512 GB disk and I need to clear up some space but I can’t wait half an hour for files to copy onto one of those HDDs. I really can’t stand it. For some reason I still do this, because I don’t entirely trust cloud storage. But… why? If I step back and think about it, what about “The Cloud” could possibly be worse than the way I’m currently doing things?

I’m not really sure why this isn’t being used as a selling point for cloud drive services… maybe it’s just too technical and esoteric for the average user who hasn’t accumulated a lifetime’s worth of digital detritus.

Side note: Four years ago I had this to say. Maybe that’s why I’m still doing things my way.

The Apple Watch “Today’s Date” complication is the stupidest bit of skeuomorphism in years

Although I hadn’t worn a watch in about 15 years, I quickly embraced the Apple Watch when it first became available, and I have now owned 4 or 5 of them (seriously, I’ve lost count), culminating in my current Apple Watch Series 8 with cellular. It is a brilliant piece of technology. But there is one thing I think is absolutely stupid.

This:


No, not the whole watch face, which I rather like. I mean this:


Watches are an at-a-glance device. Even though the micro-apps on its face are called “complications,” there should not be anything complicated about using them. But the corner “Today’s Date” complication is JUST SO FREAKING STUPID.

If I want to know today’s date, I want to know today’s date. And I want to be able to discern it from an instantaneous flit of my eyes down to my wrist. Unfortunately, the design of this complication utterly fails at that simple task for two reasons.

First, the current date number itself is too small, and it’s in reversed type, which reduces its legibility significantly. With my aging eyes, I need to do various contortions to just register what it reads.

But it’s worse than that, because the reason it’s so small (and, arguably, why it has the weird reversed design), is because the complication is apparently intended to look like one of those old mechanical watches that had an inner dial numbered 1 to 31 that would rotate daily. It also shows the numbers for yesterday and tomorrow. I do not need this information. I know how to count. If today is the 11th, I can quickly glean from that information that yesterday was the 10th and tomorrow is the 12th. In fact, I could do those feeble mental gymnastics much faster than I can confidently read, on this design, that today is the 11th.

If Apple weren’t wasting, effectively, over half of this complication’s screen space with superfluous adjacent numbers, it could have made today’s date considerably larger and easier to read. And, it wouldn’t need to be in reversed type that reduces its legibility.

I just wish someone could explain to me what possible rationale they had for designing it this way… so I could respond with vitriol.


Quick, what day is it?

It could be like this!

Building a WordPress block theme is shortening my life expectancy

Throughout my (now quite long) career as a web developer, I have had many ups and downs. But I have never had as many stomach aches as I have in the last year, trying to wrap my brain around a steady stream of confusing, convoluted, counterintuitive and just downright inexplicable elements of building a theme from the ground up to work with Gutenberg, a.k.a. the WordPress Block Editor.

I’ve made some major progress over the course of the year, and my theme (in various stages of completion) is now powering multiple live client sites, with development ongoing for a few more. For the most part, now, I am finally at a stage where I feel like this is the right way to use WordPress going forward, rather than just reluctantly accepting that I have no choice in the matter.

But I still feel like Gutenberg does a lot of things the wrong way — most notably in its fundamental lack of separation between content and presentation. Yes, I am going to Old Man Yells At Cloud this. I know React is the new hotness and now everything needs to be done in ES6 (which I will forever call JavaScript), but the WordPress core team is throwing away some of the platform’s greatest strengths by abandoning this core component of how it (like pretty much any 2000s-era CMS) is built.

It may seem that I’m just an old curmudgeon who doesn’t want to learn React (I don’t), but it’s not just that. It’s that every aspect of this interface that has been designed to make it easier for average users to interact with — which, I think, it finally is, 5 years after it was unceremoniously forced on us — makes the process of developing for it harder, and more abstract.

There are two unrelated but connected problems with how things are going down here.

First, modern developers just love dependencies.

I get it. To an extent. Reusing tried-and-true code libraries instead of rolling your own all the time is smart. But that means you’re using code you probably haven’t looked at closely. You don’t really know how it works. It may have bugs, or it may have opaque features you don’t realize are there, or it may just have too much stuff bloating it, slowing down performance and making applications more brittle. Pile dozens of these dependencies together, and you’ve got a lumbering behemoth of code that no one in the world completely understands. And I truly do believe we are at a point where no one, at all, knows entirely how the current version of WordPress works. On top of that, any time you’ve got external dependencies, weird things can happen.

Second, Gutenberg is evolving so quickly that the documentation hasn’t kept up.

Gutenberg’s documentation is occasionally out-of-date, always incomplete, and it’s only getting worse.

I know writing documentation is tedious, and the web has never had good documentation. When I was in college in the mid-’90s and I wanted to learn HTML, I went to the campus computing department and asked them how I could go about learning HTML. They, seriously, just told me to download BBEdit. Which I did. And which didn’t help me learn HTML at all. (Although it is still the text editor I write all my code in, 29 years later.) So how did I learn HTML? View source. Because back then, you could do that.

I don’t expect to be able to just “view source” and learn how Gutenberg works. But since WordPress is open source software, and I have the files right here on my computer, I do think that when the documentation fails me, I should be able to poke around in the source code and find what I’m looking for.

Let’s get specific. As it happens, in my theme I’m addressing one of my earlier complaints above by using ACF Blocks. It’s been a rough road, but I’m starting to make really good progress. The only problem is, my styles aren’t getting applied. My CSS for the block isn’t loading in the Block Editor, and the Block Editor styles I’ve configured my block to support (colors, spacing, typography) via its block.json file are not showing up on the front end.

Well, what do I do about that?

Focusing on the front end first, I know that Gutenberg’s styles get applied courtesy of pithy CSS class names like .has-primary-background-color as well as HTML style attributes using CSS variables, like var(--wp--preset--spacing--80).

But if I look at the block attributes in the Block Editor’s comment tag, or the JSON or PHP array of style properties for the block, I see the same is formatted as such: var:preset|spacing|80

The quarter century of development experience in my old fart brain tells me that there must be a function or method, somewhere, that converts var:preset|spacing|80 into var(--wp--preset--spacing--80), and that I would be better off trying to find that function than writing my own.

Uhhh… OK. So how do I go about that?

ACF’s documentation for this feature is abysmal, which is kind of understandable, since the whole thing is a moving target that is changing rapidly (not to mention the organizational challenges that happen when the company that bought you out gets bought out itself), and the core WordPress documentation isn’t much better. So I’m left resorting to a scavenger hunt through the WordPress code. But it’s layer upon layer of 5-line functions referencing each other through a series of add_filter() callbacks.

As usual with my Gutenberg rants, I don’t have any solid conclusions to end on here. This whole post was mostly an exercise in working out that knot that was gnawing at my insides. At least I’ve done that. But I’m no closer to solving my problem. That’s probably because the real problem isn’t what I think it is. And it’s not going away.

All I know is, building a block theme — at least, for me, right now — takes way longer than building a classic theme. And I think that’s because my approach, one developer just cranking away, is not the model anyone in the core WordPress development community cares about, or possibly even comprehends existing. These days I’m not extremely confident about its continued viability myself.


Post script: I think I actually managed to find it, by using BBEdit’s multi-file search on this string: '|'

The method is: WP_Theme_JSON::get_property_value()

Of course, that doesn’t get called directly. It’s called in WP_Theme_JSON::compute_style_properties() which is in turn called by WP_Theme_JSON::get_block_classes() which itself is in turn called by WP_Theme_JSON::get_stylesheet() and then we’re getting too far afield, because that’s used to turn the theme.json file into inline CSS.

So I am guessing at this point that I probably should not use any of these methods. (Actually, I can’t because they’re all protected.) It really seems like this should be happening automatically, and either ACF Blocks are missing some key functionality, or I’m missing something about how ACF Blocks work (which I would blame on the lack of documentation).


Update (April 11, 2023): After I wrote this blog post, I also started a thread on the ACF forum, and there I was finally given an answer. Yes, there is a WordPress function for getting block wrapper attributes. It is even, um, named exactly what it should be. But as the fellow ACF user who responded with that enlightening bit of information even noted, it is incredibly difficult to find. The WordPress documentation does, to its credit, include most if not all (I mean, how would I actually know?) functions and methods, but the search tool is a joke.