Web Development

0 TILs · 8 blogmarks

All TILs → All blogmarks →

Blogmark

On "Preventing Paste for a 'Destructive Action' Confirmation Input"

A general principle I have is that you shouldn't ever (I'm sure there are some rare, specialized caveats) prevent someone from pasting into a text area in a web app. Financial/IRS forms sometimes like to prevent you from pasting the "Account number confirmation" or "Routing number confirmation" field. Don't do that. I'm directly copying it from my bank website, I don't need you to force me to type it out to somehow "prevent" a mistake.

Same principle here. Don't disable paste on a text field even if it is a field meant to slow you down on an irreversible or destructive action. There are better UX solutions to reach for if you are worried about people automating the "danger zone" field. E.g.

  • have a 5s delay where the person can click 'undo' if it was a mistake
  • implement a soft-delete system that archives for now and fully deletes in 30 days

Here is an example of GitHub requiring you type the qualified name of the repository to confirm that you want to transfer ownership.

image

Notably, they don't prevent you from pasting.

I see this confirmations as making destructive actions cat-proof (you know, when a cat walks on your laptop keyboard and trackpad), not script-proof. Scripts can easily get around the paste restriction anyway. All you're doing when preventing paste is adding extra UI logic to make your UX worse.

Blogmark

Don't Guess My Language

https://vitonsky.net/blog/2025/05/17/language-detection/

Every browser sends an Accept-Language header. It tells you what language the user prefers, not based on location, not based on IP, based on their OS or browser config. And yes, users can tweak it if they care enough.

It looks like this: Accept-Language: en-US,en;q=0.9,de;q=0.8

That’s your signal, use it. It’s accurate, it’s free, it’s already there, no licensing, no guesswork, no maintenance.

As an example of when the location associated with an IP address is a reasonable heuristic: many course selling platforms use that to determine what if any Purchase Power Parity (PPP) discount to offer.

Blogmark

Sync Engines

Over the last year or so I’ve seen several sync engines pop up as a paradigm shift in how we think about client and server data.

TanstackDB which is a generalized client but was built in partnership with ElectricSQL is described as:

A reactive client store for building super fast apps on sync

TanStack DB extends TanStack Query with collections, live queries and optimistic mutations that keep your UI reactive, consistent and blazing fast 🔥

Blogmark

Stop using REST for state synchronization

https://www.mbid.me/posts/stop-using-rest-for-state-synchronization/

What struck me is how incredibly cumbersome, repetitive and brittle this programming model is, and I think much of this is due to using REST as interface between the client and the server. REST is a state transfer protocol, but we usually want to synchronize a piece of state between the client and the server. This mismatch means that we usually implement ad-hoc state synchronization on top of REST, and it turns out that this is not entirely trivial and actually incredibly cumbersome to get right.

Blogmark

The ideal viewport doesn’t exist

https://viewports.fyi/

There is a lot of interesting data in this article about the wide variations in viewport size. The particular thing that stuck out to me is that even for a single iPhone, you can easily have at least three different viewport sizes based on viewing context — Safari vs. in-app browser vs. 3D touch preview are the ones they show.

Found on Bluesky.