Ptree: Interactive Tree of Life Explorer Blog & articles

Blog · Craft · · 2 min read

Never use Figma

Static mockups hide almost everything that determines whether software works. When you draw a screen in Figma and hand it off to be "implemented," the drawing strips away unknown text lengths, overflow, resizing, keyboard focus, scrolling, network latency, interrupted transitions, and state combinations. A screenshot records one frozen pose filled with curated fake data. It cannot specify a live system.

In Ptree, design and implementation are one search carried out directly in the browser. The working page is the design document.

Friction in CSS is design evidence

When an apparently simple visual idea requires wrapper <div>s, JavaScript width measurements, magic pixel coordinates, or a stack of !important overrides, the usual reaction is to push harder until the pixels match the mockup. That gets the causality backward. Heavy implementation friction is a sign that the design itself does not fit the medium.

Before forcing a box into place, ask which element is supposed to size which. Ptree's Tree view never had responsive breakpoints drawn for "mobile," "tablet," and "desktop" artboards. Instead, CSS declares the readable width band of a single column (--fit-min: calc(14ex + 6.6ex) to --fit-max: calc(21ex + 6.6ex)) and computes the integer column count continuously across every viewport width:

--ncols: max(1, min(round(down, calc(var(--live-width) / var(--fit-min)), 1),
                    round(up, calc(var(--live-width) / var(--fit-max)), 1)));

No static artboard could have discovered that law. Once that law exists, every window width from a narrow phone to an ultrawide monitor works automatically with zero media-query breakpoints.

Let the platform shape the interface

Working directly in HTML and CSS lets the browser's own layout algorithms, native controls, and cascade guide the UI. Often that yields a cleaner design than anything you would have drawn by hand.

Ptree's numeric range filters look like an editor's trim brackets that dim the excluded ends of a legend track. Drawn in a design tool, someone would specify a custom widget with drag handles, a JavaScript bounding-box hit tester, and two overlay <div>s whose widths update on every pointermove. Built directly in CSS, the control is just two overlapping native <input type="range"> elements. Each thumb casts a 100vw box-shadow outward (--cast: -100vw and 100vw), and overflow: hidden on the inputs clips that shadow neatly to the track. Keyboard navigation, touch dragging, screen-reader semantics, and visual dimming all come from the same eight lines of CSS.

The legend carousel came from the same habit. Every property key sits in the same 1 / 1 grid cell inside <fieldset>, so the tallest key sets the legend's height automatically with no fixed pixel measurement. Switching properties shifts a single registered --ki number. If a future property needs two lines, the container grows on its own without touching a single coordinate.

System perfection, not pixel perfection

Mockup-driven development optimizes for an isolated snapshot, and often wrecks the architecture underneath just to reproduce an arbitrary pixel gap from that snapshot. Optimizing the whole system means refusing both bad extremes: neither a clumsy interface that serves a neat abstraction, nor a pretty picture held up by tangled machinery.

Whenever either the interface or the code needs an exception list to satisfy the other, keep searching. Almost always there is an underlying rule where the cleanest interface and the simplest implementation turn out to be the exact same answer.