Jim Nielsen’s Blog

You found my experimental HTML feed (there are also other ways to subscribe).

I HTML

Recent posts

Book Notes: “The Order of Time” by Carlo Rovelli

View

I recently finished Carlo Rovelli’s book “The Order of Time” and, of course, had a few web-adjacent thoughts come to mind.

Who says lessons from physics can’t be applied to making software? (I know, nobody is actually dying on that hill.)

A Weakness of Being Data-Driven

Being data-driven is the most scientific way of building products? Hold that thought:

The ability to understand something before it’s observed is at the heart of scientific thinking.

If you can only imagine that which you can observe, understand, and measure, you’re limiting yourself.

If you can only believe that which you can observe, then you’ll only ever understand that which you can see.

Abstract thought can anticipate by centuries hypotheses that find use — or confirmation — in scientific inquiry.

Beware the Prejudice of the Self-Evident

The things that seemed self-evident to us were really no more than prejudices.

The earth is flat. The sun revolves around the earth. These were mistakes determined by our perspective.

There are undoubtedly more things that seem self-evident now, but as we progress in experience and knowledge we will realize that what seems self-evident is merely a prejudice of our perspective given our time and place in the world.

There’s always room to be wrong.

Children grow up and discover that the world is not as it seemed from within the four walls of their homes. Humankind as a whole does the same thing.

Asking the Wrong Questions

When we cannot formulate a problem with precision, it is often not because the problem is profound; it’s because the problem is false.

Incredibly relevant to building software. If you can’t explain a problem (and your intended solution), it’s probably not a problem.

Objectivity Is Overrated

When we do science, we want to describe the world in the most objective way possible. We try to eliminate distortions and optical illusions deriving from our point of view. Science aspires to objectivity, to a shared point of view about which it is possible to be in agreement.

This is admirable, but we need to be wary about what we lose by ignoring the point of view from which we do the observing. In its anxious pursuit of objectivity, science must not forget that our experience of the world comes from within. Every glance that we cast toward the world is made from a particular perspective.

I love this idea. Constantly striving for complete and total objectivity is like trying to erase yourself from existence.

As Einstein showed, point of view is everything in a measurement. Your frame of reference is important because it’s yours, however subjective, and you cannot escape it.

What we call “objectivity” may merely be the interplay between different subjective perspectives. As Matisse said, “I don’t paint things. I paint the relationship between things.”


Reply via: Email · Mastodon · Bluesky

A Few Thoughts on Customizable Form Controls

View

Web developers have been waiting years for traction in styling HTML form controls. Is it possible the day has come? Here’s Jen Simmons on Mastodon:

My team is working on a solution — you’ll apply appearance: base and switch to a new interoperable, consistent controls with easy to override default CSS. They inherit much more of what you already have going on. And then you can override (even more of) those styles using new pseudo-elements.

If you want the details, check out the working draft. It’s pretty cool what they’ve come up with, especially in the face of what is undoubtedly a Herculean task to balance developer desire against user preference while preserving accessibility standards. I applaud all involved 👏

That said, I have thoughts. Not new ones. I’ve voiced them before. And I’ll do it again.

As developers, we’ve long been clamoring for this functionality:

“We want to override defaults, give us more control!”

But I wish there was equal voice for:

“We want better defaults, not more control!”

More control means you have to do more work. I don’t want to do more work, especially for basic computing controls. There are too many edge cases to think about across the plethora of devices, etc. that exist in the world wide web — it’s overwhelming if you stop to think about them all, let alone write them down.

I want to respect user choice (which includes respecting what hardware and OS they’ve chosen to use) and build web user interfaces on top of stable OS primitives.

Give me better APIs for leveraging OS primitives rather than, or I should say in addition to, APIs to opt out of them completely.

That’s me, the developer talking. But there’s a user-centric point to be made here too: when you re-invent the look, appearance, and functionality of basic form inputs for every website you’re in charge of, that means every user is forced to encounter inconsistent form controls across the plethora of websites they visit.

I’m not saying don’t do this. The web is a big place. There’s undoubtedly a need for it. But not all websites need it, and I’m afraid it’ll be the default posture for handling form controls. I don’t need different radio controls for every healthcare form, shopping cart, and bank account website I use.

As a user, I’d prefer a familiar, consistent experience based on the technology choices (hardware, OS, etc.) I’ve made.

As a developer, I don’t want to consistently “re-invent the wheel” of basic form controls.

Sure, sometimes I may need the ability to opt-out of browser defaults. But increasingly I instead want to opt-in to better browser (and OS) defaults. Less UI primitive resets and more UI primitive customizations. I want to build on top of stable UI pace layers.


Reply via: Email · Mastodon · Bluesky

Proving Binaries

View

Heydon Pickering has an intriguing video dealing with the question: “Why is everything binary?” The gist of the video, to me, distills to this insight:

The idea that [everything] belongs to one of two archetypes is seductive in its simplicity, so we base everything that we do and make on this false premise.

That rings true to me. I tend to believe binary thinking is so prevalent because it’s the intellectual path of least resistance and we humans love to lazy.

The fact is, as I’m sure any professional with any experience in any field will tell you, answers are always full of nuance and best explained with the statement “it depends”.

The answers we’re all looking for are not found exclusively in one of two binary values, but in the contrast between them. In other words, when you test the accuracy of binary assertions the truth loves to reveal itself somewhere in between.[1]

For example: peak design or development is found in the intermingling of form and function. Not form instead of function, nor function instead of form.

Working on the web, we’re faced with so many binary choices every day:

  • Do we need a designer or a developer?
  • Do we make a web site or a web app?
  • Should we build this on the client or the server?
  • Are we driven by data or intuition?
  • Does this work online or offline?

And answering these questions is not helped by the byproduct of binary thinking, which as Heydon points out, results in intellectually and organizationally disparate structures like “Design” and ”Development”:

  1. Design thinking, but not about how to do the thing you are thinking about.
  2. Development doing, but without thinking about why the hell anyone would do this in the first place.

It’s a good reminder to be consistently on guard for our own binary thinking. And when we catch ourselves, striving to look at the contrast between two options for the answer we seek.


  1. There’s a story that illustrates how you can reject binaries and invert the assumption that only two choices exist. It goes like this: A King told a condemned prisoner: “You may make one final statement. If it is true, you will be shot. If it is false, you will be hanged.” The prisoner answered, “I will be hanged.” This results in the King not being able to carry out any sentence. The prisoner manipulates the King’s logic to make both options impossible and reveal a third possible outcome.

Reply via: Email · Mastodon · Bluesky

Ecosystems vs. Artifacts: Don’t Break the Web

View

Here’s Gordon Brander in an article titled “Don't fork the ecosystem”:

Most of our software has been shaped by chance decisions made in haste by people who could not have predicted how the system would end up being used today.

And if we could rebuild those systems today, knowing what we know now, we’d invent a whole new class of problems for ourselves twenty years from now.

Software can be rebuilt, because software is a machine. But a software ecosystem is not a machine. It is a living system. When we attempt to rebuild the ecosystem, we’re making a category error. We confuse the software for the ecological process unfolding around it.

Seems akin to hiring and firing. People are not cogs in a machine. Team dynamics are disrupted when people leave, as an ecosystem is being tampered with.

When I was a kid, I did not understand why we couldn’t “just” go back to the moon. We’d already done it once before. So if we’d done it before, can’t we just do it again? I thought of it like riding a bicycle: once you know how to do it, can’t you just do it again whenever you want?

Only as I grew older did I come to understand that an entire ecosystem of people, processes, tools, organizations, experience, storehouses of knowledge, and more made it possible to go to the moon. And you can’t just turn that back on with the flip of a switch.

I was confusing the artifact (a human being on the moon) for the ecosystem that made it possible (NASA, contractors, government officials, technology, etc.)

Carrying forward old baggage offends our sense of aesthetics, but hey, that’s how evolved systems work. Chickens still carry around the gene for dinosaur teeth. This is because a living system must be viable at every evolutionary stage. It can never pause, reset, or make a breaking change. The path of evolution is always through the adjacent possible.

Lesson: the web isn’t an artifact. It’s an ecosystem. Don’t break the web.


Reply via: Email · Mastodon · Bluesky

Building Websites With LLMS

View

And by LLMS I mean: (L)ots of (L)ittle ht(M)l page(S).

I recently shipped some updates to my blog. Through the design/development process, I had some insights which made me question my knee-jerk reaction to building pieces of a page as JS-powered interactions on top of the existing document.

With cross-document view transitions getting broader and broader support, I’m realizing that building in-page, progressively-enhanced interactions is more work than simply building two HTML pages and linking them.

I’m calling this approach “lots of little HTML pages” in my head. As I find myself trying to build progressively-enhanced features with JavaScript — like a fly-out navigation menu, or an on-page search, or filtering content — I stop and ask myself: “Can I build this as a separate HTML page triggered by a link, rather than JavaScript-injected content built from a button?”

I kinda love the results. I build separate, small HTML pages for each “interaction” I want, then I let CSS transitions take over and I get something that feels better than its JS counterpart for way less work.

Allow me two quick examples.

Example 1: Filtering

Working on my homepage, I found myself wanting a list of posts filtered by some kind of criteria, like:

  • The most recent posts
  • The ones being trafficked the most
  • The ones that’ve had lots of Hacker News traffic in the past

My first impulse was to have a list of posts you can filter with JavaScript.

But the more I built it, the more complicated it got. Each “list” of posts needed a slightly different set of data. And each one had a different sort order. What I thought was going to be “stick a bunch of <li>s in the DOM, and show hide some based on the current filter” turned into lots of data-x attributes, per-list sorting logic, etc. I realized quickly this wasn’t a trivial, progressively-enhanced feature. I didn’t want to write a bunch of client-side JavaScript for what would take me seconds to write on “the server” (my static site generator).

Then I thought: Why don’t I just do this with my static site generator? Each filter can be its own, separate HTML page, and with CSS view transitions I’ll get a nice transition effect for free!

Minutes later I had it all working — mostly, I had to learn a few small things about aspect ratio in transitions — plus I had fancy transitions between “tabs” for free!

Animated gif showing a link that goes to a new document and the list re-shuffles and re-sorts its contents in an animated fashion.

This really feels like a game-changer for simple sites. If you can keep your site simple, it’s easier to build traditional, JavaScript-powered on-page interactions as small, linked HTML pages.

Example 2: Navigation

This got me thinking: maybe I should do the same thing for my navigation?

Usually I think “Ok, so I’ll have a hamburger icon with a bunch of navigational elements in it, and when it’s clicked you gotta reveal it, etc." And I thought, “What if it’s just a new HTML page?”[1]

Because I’m using a static site generator, it’s really easy to create a new HTML page. A few minutes later and I had it. No client-side JS required. You navigate to the “Menu” and you get a page of options, with an “x” to simulate closing the menu and going back to where you were.

Anitmated gif of a menu opening on a website (but it’s an entirely new HTML page).

I liked it so much for my navigation, I did the same thing with search. Clicking the icon doesn’t use JavaScript to inject new markup and animate things on screen. Nope. It’s just a link to a new page with CSS supporting a cross-document view transition.

Granted, there are some trade-offs to this approach. But on the whole, I really like it. It was so easy to build and I know it’s going to be incredibly easy to maintain!

I think this is a good example of leveraging the grain of the web. It’s really easy to build a simple website when you can shift your perspective to viewing on-page interactivity as simple HTML page navigations powered by cross document CSS transitions (rather than doing all of that as client-side JS).


  1. Jason Bradberry has a neat article that’s tangential to this idea over at Piccalil. It’s more from the design standpoint, but functionally it could work pretty much the same as this: your “menu” or “navigation” is its own page.

Reply via: Email · Mastodon · Bluesky

AX, DX, UX

View

Matt Biilman, CEO of Netlify, published an interesting piece called “Introducing AX: Why Agent Experience Matters” where he argues the coming importance of a new “X” (experience) in software: the agent experience, meaning the experience your users’ AI agents will have as automated users of products/platforms.

Too many companies are focusing on adding shallow AI features all over their products or building yet another AI agent. The real breakthrough will be thinking about how your customers’ favorite agents can help them derive more value from your product. This requires thinking deeply about agents as a persona your team is building and developing for.

In this future, software that can’t be used by an automated agent will feel less powerful and more burdensome to deal with, whereas software that AI agents can use on your behalf will become incredibly capable and efficient. So you have to start thinking about these new “users” of your product:

Is it simple for an Agent to get access to operating a platform on behalf of a user? Are there clean, well described APIs that agents can operate? Are there machine-ready documentation and context for LLMs and agents to properly use the available platform and SDKs? Addressing the distinct needs of agents through better AX, will improve their usefulness for the benefit of the human user.

In summary:

We need to start focusing on AX or “agent experience” — the holistic experience AI agents will have as the user of a product or platform.

The idea is: teams focus more time and attention on “AX” (agent experience) so that human end-users can bring their favorite agents to our platforms/products and increase productivity.

But I’m afraid the reality will be that the limited time and resources teams spend today building stuff for humans will instead get spent building stuff for robots, and as a byproduct everything human-centric about software will become increasingly subpar as we rationalize to ourselves, “Software doesn’t need to be good for human because humans don’t use software anymore. Their robots do!” In that world, anybody complaining about bad UX will be told to shift to using the AX because “that’s where we spent all our time and effort to make your experience great”.

Prior Art: DX

DX in theory: make the DX for people who are building UX really great and they’ll be able to deliver more value faster.

DX in practice: DX requires trade-offs, and a spotlight on DX concerns means UX concerns take a back seat. Ultimately, some DX concerns end up trumping UX concerns because “we’ll ship more value faster”, but the result is an overall degradation of UX because DX was prioritized first.

Ultimately, time and resources are constraining factors and trade-offs have to be made somewhere, so they’re made for and in behalf of the people who make the software because they’re the ones who feel the pain directly. User pain is only indirect.

Future Art: AX

AX in theory: build great stuff for agents (AX) so people can use stuff more efficiently by bringing their own tools.

AX in practice: time and resources being finite, AX trumps UX with the rationale being: “It’s ok if the human bit (UX) is a bit sloppy and obtuse because we’ll make the robot bit (AX) so good people won’t ever care about how poor the UX is because they’ll never use it!”

But I think we know how that plays out. A few companies may do that well, but most software will become even more confusing and obtuse to humans because most thought and care is poured into the robot experience of the product.

The thinking will be: “No need to pour extra care and thought into the inefficient experience some humans might have. Better to make the agent experience really great, so humans won’t want to interface with our thing manually.”

In other words: we don’t have the time or resources to worry about the manual human experience because we’ve got all these robots to worry about!

It appears there’s no need to fear AI becoming sentient and replacing us humans. We’ll phase ourselves out long before the robots ever become self-aware.

All that said, I’m not against the idea of “AX” but I do think the North Star of any “X” should remain centered on the (human) end-user.

UX over AX over DX.


Reply via: Email · Mastodon · Bluesky

Can You Get Better Doing a Bad Job?

View

Rick Rubin has an interview with Woody Harrelson on his podcast Tetragrammaton. Right at the beginning Woody talks about his experience acting and how he’s had roles that did’t turn out very well. He says sometimes he comes away from those experiences feeling dirty, like “I never connected to that, it never resonated, and now I feel like I sold myself...Why did I do that?!”

Then Rick asks him: even in those cases, do you feel like you got better at your craft because you did your job? Woody’s response:

I think when you do your job badly you never really get better at your craft.

Seems relevant to making websites.

I’ve built websites on technology stacks I knew didn’t feel fit for their context and Woody’s experience rings true. You just don’t feel right, like a little voice that says, “You knew that wasn’t going to turn out very good. Why did you do that??”

I don’t know if I’d go so far as to say I didn’t get better because of it. Experience is a hard teacher. Perhaps, from a technical standpoint, my skillset didn’t get any better. But from an experiential standpoint, my judgement got better. I learned to avoid (or try to re-structure) work that’s being carried out in a way that doesn’t align with its own purpose and essence.

Granted, that kind of alignment is difficult. If it makes you feel any better, even Woody admits this is not an easy thing to do:

I would think after all this time, surely I’m not going to be doing stuff I’m not proud of. Or be a part of something I’m not proud of. But damn...it still happens.


Reply via: Email · Mastodon · Bluesky

Limitations vs. Capabilities

View

Andy Jiang over on the Deno blog writes “If you're not using npm specifiers, you're doing it wrong”:

During the early days of Deno, we recommended importing npm packages via HTTP with transpile services such as esm.sh and unpkg.com. However, there are limitations to importing npm packages this way, such as lack of install hooks, duplicate dependency resolution issues, loading data files, etc.

I know, I know, here I go harping on http imports again, but this article reinforces to me that one man’s “limitations” are another man’s “features”.

For me, the limitations (i.e. constraints) of HTTP imports in Deno were a feature. I loved it precisely because it encouraged me to do something different than what node/npm encouraged.

It encouraged me to 1) do less, and 2) be more web-like. Trying to do more with less is a great way to foster creativity. Plus, doing less means you have less to worry about.

Take, for example, install hooks (since they’re mentioned in the article). Install hooks are a security vector. Use them and you’re trading ease for additional security concerns. Don’t use them and you have zero additional security concerns. (In the vein of being webby: browsers don’t offer install hooks on <script> tags.)

I get it, though. It’s hard to advocate for restraint and simplicity in the face of gaining adoption within the web-industrial-complex. Giving people what they want — what they’re used to — is easier than teaching them to change their ways.

Note to self: when you choose to use tools with practices, patterns, and recommendations designed for industrial-level use, you’re gonna get industrial-level side effects, industrial-level problems, and industrial-level complexity as a byproduct.

As much as its grown, the web still has grassroots in being a programming platform accessible by regular people because making a website was meant to be for everyone. I would love a JavaScript runtime aligned with that ethos. Maybe with initiatives like project Fugu that runtime will actually be the browser.


Reply via: Email · Mastodon · Bluesky

Sanding UI, pt. II

View

Let’s say you make a UI to gather some user feedback. Nothing complicated. Just a thumbs up/down widget. It starts out neutral, but when the user clicks up or down, you highlight what they clicked an de-emphasize/disable the other (so it requires an explicit toggle to change your mind).

A set of thumbs-up and thumbs-down icons in various states, with some in grayscale and others highlighted in green or red.

So you implement it. Ship it. Cool. Works right?

Well, per my previous article about “sanding” a user interface UI by clicking around a lot, did you click on it a lot?

If you do, you’ll find that doing so selects the thumbs up/down icon as if it were text:

Animated gif of a thumbs up icon being clicked repeatedly and gaining a text selection UI native to the OS.

So now you have this weird text selection that’s a bit of an eye sore. It’s not relevant to text selection because it’s not text. It’s an SVG. So the selection UI that appears is misleading and distracting.

A thumbs up icon that was clicked repeatedly and has a text selection UI native to the OS overlaid on it.

One possible fix: leverage the user-select: none property in CSS which makes it not selectable. When the user clicks multiple times to toggle, no text selection UI will appear.

A thumbs up icon with a cursor over it and no text selection UI.

Cool. Great!

Another reason to click around a lot. You can ensure any rough edges are smoothed out, and any “UI splinters” are ones you get (and fix) in place of your users.


Reply via: Email · Mastodon · Bluesky

CSS Space Toggles

View

I’ve been working on a transition to using light-dark() function in CSS.

What this boils down to is, rather than CSS that looks like this:

:root {
  color-scheme: light;
  --text: #000;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --text: #fff;
  }
}

I now have this:

:root {
  color-scheme: light;
  --text: light-dark(#000, #fff);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
  }
}

That probably doesn’t look that interesting. That’s what I thought when I first learned about light-dark() — “Oh hey, that’s cool, but it’s just different syntax. Six of one, half dozen of another kind of thing.”

But it does unlock some interesting ways to handling themeing which I will have to cover in another post. Suffice it to say, I think I’m starting to drink the light-dark() koolaid.

Anyhow, using the above pattern, I want to compose CSS variables to make a light/dark theme based on a configurable hue. Something like this:

:root {
  color-scheme: light;
  
  /* configurable via JS */
  --accent-hue: 56; 
  
  /* which then cascades to other derivations */
  --accent: light-dark(
    hsl(var(--accent-hue) 50% 100%),
    hsl(var(--accent-hue) 50% 0%),
  );
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
  }
}

The problem is that --accent-hue value doesn’t quite look right in dark mode. It needs more contrast. I need a slightly different hue for dark mode. So my thought is: I’ll put that value in a light-dark() function.

:root {
  --accent-hue: light-dark(56, 47);
  --my-color: light-dark(
    hsl(var(--accent-hue) 50% 100%),
    hsl(var(--accent-hue) 50% 0%),
  );
}

Unfortunately, that doesn’t work. You can’t put arbitrary values in light-dark(). It only accepts color values.

I asked what you could do instead and Roma Komarov told me about CSS “space toggles”. I’d never heard about these, so I looked them up.

First I found Chris Coyier’s article which made me feel good because even Chris admits he didn’t fully understand them.

Then Christopher Kirk-Nielsen linked me to his article which helped me understand this idea of “space toggles” even more.

I ended up following the pattern Christopher mentions in his article and it works like a charm in my implementation! The gist of the code works like this:

  1. When the user hasn’t specified a theme, default to “system” which is light by default, or dark if they’re on a device that supports prefers-color-scheme.
  2. When a user explicitly sets the color theme, set an attribute on the root element to denote that.
/* Default preferences when "unset" or "system" */
:root {
  --LIGHT: initial;
  --DARK: ;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --LIGHT: ;
    --DARK: initial;
    color-scheme: dark;
  }
}

/* Handle explicit user overrides */
:root[data-theme-appearance="light"] {
  --LIGHT: initial;
  --DARK: ;
  color-scheme: light;
}
:root[data-theme-appearance="dark"] {
  --LIGHT: ;
  --DARK: initial;
  color-scheme: dark;
}

/* Now set my variables */
:root {
  /* Set the “space toggles’ */
  --accent-hue: var(--LIGHT, 56) var(--DARK, 47);
  
  /* Then use them */
  --my-color: light-dark(
    hsl(var(--accent-hue) 50% 90%),
    hsl(var(--accent-hue) 50% 10%),
  );
}

So what is the value of --accent-hue? That line sort of reads like this:

  • If --LIGHT has a value, return 56
  • else if --DARK has a value, return 47

And it works like a charm! Now I can set arbitrary values for things like accent color hue, saturation, and lightness, then leverage them elsewhere. And when the color scheme or accent color change, all these values recalculate and cascade through the entire website — cool!

A Note on Minification

A quick tip: if you’re minifying your HTML and you’re using this space toggle trick, beware of minifying your CSS! Stuff like this:

selector {
  --ON: ;
  --OFF: initial;
}

Could get minified to:

selector{--OFF:initial}

And this “space toggles trick” won’t work at all.

Trust me, I learned from experience.


Reply via: Email · Mastodon · Bluesky