Number Scrubbing in Code Editors

<input type="number"> renders differently across browsers, and some of them provide increment/decrement controls — the up and down arrows commonly called spinners. That default is occasionally useful, but developers have tried far richer approaches to changing a numeric value, and scrubbing is one of them. The interaction has a long pedigree; Photoshop has offered it for years.

Dominik Jančík recently published a demo that brings scrubbing inside a code block: with a mouse, you hover the numbers and drag left or right to raise or lower them. Jančík asked about getting the feature into CodePen itself. The author finds the idea appealing but admits some hesitation about modifying the core editor, having been burned by such changes before. The better home, in their view, is a plugin for CodeMirror, Monaco, or Ace.

Some form of it likely already exists for Ace, since the Khan Academy editor supports scrubbing. Another example surfaced in a search for prior art: Fabrice Weinberg's version, which ships with plenty of options. A recollection that Lea Verou's Dabblet did the same turned out to be mistaken, though Dabblet does have notable popups.

Dabblet also increments numbers with ⌥+↑ and ⌥+↓, and CodePen supports those shortcuts too, via Emmet. The post closes by asking readers to share number scrubber UX they like.