Where Focus Goes
Edit the title, click into the body, and the caret takes a brief round trip. Following that trip revealed something useful — focus isn't a state, it's the sum of several machines.
Where Focus Goes
I noticed something interesting in the desktop detail view. Edit the title, then click into the description without saving, and the caret enters the body — then steps out and back for a beat, right as you’re about to type. The data is fine; saving is exact. This is purely a story about focus.
How many machines touch focus?
Following the trail, it turned out more than one machine could touch focus at that exact moment.
The first is the edit-finish machine. The title input has a behavior: on explicit save (check button or Enter), end editing and return focus to the panel — so the next ESC closes the modal. Sound design on its own. The interesting part was timing. This machine was wired not only to explicit saves but also to natural blur saves (title saved because you clicked another field), and since saving is asynchronous, it completes after the user has already entered the body. A past save was steering a future focus.
The second is the sync machine. Whenever the document model updates, the detail view resets any editor that isn’t mid-edit to the server value — a diligent mechanism for reflecting other devices’ changes. Its means of resetting is a remount. A title save’s response is also “a model update,” so the machine runs; the body editor you just clicked into — focused but not yet typed — counts as “not mid-edit” and gets remounted. A remounted editor holds no focus.
Two machines, overlapping on the same instant. The phenomenon surviving the first adjustment is exactly what revealed the second machine existed.
Giving each machine its “when”
The fix was attaching precise conditions to both. The edit-finish machine: only on explicit save. The sync machine: only when the field isn’t focused and its server value actually changed. Saving a title doesn’t change the body’s value, so the body editor now experiences nothing at all.
There was a side benefit. Uploading an attachment also updates the model, and those body-irrelevant remounts disappeared too. Narrowing a condition precisely often tidies up clutter beyond the original target.
The review’s best output was a refutation
Narrowing the sync machine’s condition deserved care, so I ran a code review. The results were interesting.
The most valuable output wasn’t a new finding but a refutation. The reviewer constructed the worst-case scenario — “skip the reset and a teammate’s remote change never reaches the screen, letting stale content overwrite their save” — then, verifying it, confirmed the editor already has value synchronization built in, caret-preserving at that. Skipping the remount never leaves the screen stale. The premise of the fix got proven that way.
There was a finding too. I had mirrored the fix into the template detail for symmetry, but the reviewer pointed out that the template’s sync effect only runs when the document itself changes — the mirrored code could never execute. Templates never had this phenomenon in the first place. The unreachable fix came out, and I picked up a habit: before mirroring a change, check that the target code actually runs under the same conditions.
What today taught
Focus looks like a single state, but it’s really a sum — several machines touching it, each for its own reason. So “focus feels off” is rarely one machine’s problem; it’s the machines’ “when”s being loose. Give each one a precise timing condition and they do their jobs without crossing each other. And for checking those conditions, a second pair of eyes that starts from a different question turned out to be well worth it.