Carets and highlights in a canvas

An editable block drawn by a canvas. The browser draws the CSS caret into the picture. The canvas adds a streak behind it and wavy lines under misspelled words. Tap a marked word to correct it.

$ git commit -m "fix teh caret" Type here. The block caret is CSS, and the canvas draws the streak that follows it. Misspelled words are found by a small list on this page: recieve, seperate, definately, occured. Tap one of them to see the correction.
Tap the text to place the caret.
Show the code caret and highlights
  1. An editable element inside <selection-fx>. highlight="typo" names the CSS Custom Highlight whose ranges are measured.
  2. The caret is CSS. caret-shape, caret-color and caret-animation.
  3. Mark the misspelled words with a Highlight that has no style. The canvas draws the wavy line.
  4. Find the marked word under a tap with CSS.highlights.highlightsFromPoint().
  5. Inside the element: where the caret is. A collapsed Range has one client rectangle.
  6. The 2D effect. A quad from the old caret position to the new one, and a sine line under each marked rectangle.
  7. The shader effect. It is given no positions. It looks for the key colour in the element's picture.
  8. The whole element.

Two things only a person can check

The test browser has no find bar and no spelling dictionary. On this page find-in-page matches are styled green (::search-text) and spelling marks yellow (::spelling-error). Open find-in-page, search for caret, and press the button. It reads the canvas back and counts pixels of each colour. Zero while you can see the marks means the browser draws them over the page and leaves them out of the element's picture.

What this browser has

Live checks

These start when you press the button. They use fixtures in a corner of the window and don't take focus, so the checks on the caret itself are the numbers under the editor.

Findings

Measured in headless Chromium 157 on Linux with a software renderer, 2026-11-21.

Not built or not verified: