Fields and headings: datalist, password, selectedcontent, title and hgroup

The last five ideas of this group from the element catalogue. Three are about what a form control gives the canvas beside its picture: a list of suggestions, a field that hides its value, a copy of a chosen option. Two are about headings: the document's <title> drawn on the page, and a subtitle typed out under its heading.

Suggestion ring from a datalist

A text field with a <datalist> of eight harbours. The canvas draws the suggestions as chips on a ring round the field. Type a letter or two: the chips that match come closer and the others fade. Tap a chip to take it.

A <datalist> has no box and no picture, and the list the browser opens for it is outside the page. The canvas gets the suggestions as data and has to draw them itself. The chips aren't elements, so a screen reader doesn't have them: the page puts the list attribute back when the canvas isn't drawing.

Show the code
  1. An input and its datalist.
  2. Read the options, draw the chips, take a tap on one.
  3. Styles.

Password field that can be shared

A sign-in form, and above it a small copy of it in a dark frame: what someone watching a shared screen would get. Type in the password field, then tick the box that shows the password.

The picture of a password field is the dots. Two fields with different passwords of the same length gave the same pixels in the live check, so a stream or a capture of the canvas carries no secret. That stops when the field's type is changed, and the type is something the canvas can read.

Show the code
  1. The form.
  2. Draw it twice, and blur one field of the copy when it isn't a password field.

Hero picture from selectedcontent

A customisable select of five buoys. Its button holds a <selectedcontent> element, which the browser fills with a copy of the chosen option. The canvas draws that element a second time, large, at the top. Choose another buoy.

The large copy is a draw of the select clipped to the box of its <selectedcontent>, so it shows the option's own markup, the coloured dot included. The list of options opens in the top layer, over the canvas and not in it.

Show the code
  1. A select with a button and a <selectedcontent>.
  2. Draw the select, and the box of the copy once more, large.

Document title as a heading

The large heading in this canvas is this page's <title> element. Type a new title in the field: the heading changes, and so does the name of the browser tab, because both are the same element.

A <title> is hidden only by the browser's style sheet. Given display: block inside a canvas it has a box and a picture, and document.title still reads it, because it's still the first title element in the document.

Show the code
  1. The canvas starts empty.
  2. Move the title element in, and draw it under a canvas-drawn tab.

Subtitle that types under the title

An <hgroup> with a heading and a paragraph. The heading drops into place, then the paragraph appears one character at a time behind a cursor.

Small boats

Notes on tides, knots and weather for anyone who sails alone.

The paragraph is complete in the document from the start, so a screen reader and a search engine read all of it at once. Only the picture is revealed in steps: a clip that grows by the width of one character at a time.

Show the code
  1. The heading group.
  2. Measure the characters, then widen the clip of each line.

How it works

Show the code
  1. Each demo starts when its section comes near the screen.
  2. The paint handler shared by the five canvases.
  3. Place a block, and draw one piece of it.
  4. After a lost context the elements are shown as plain HTML.

Live checks

The checks wait for a tap. Each builds its own small canvas in a corner of the window, and none of them touches the demos above. Two of them read pixels, from a copy of their fixture made with drawImage().

Findings

Measured in headless Chromium 157 on 2026-11-22. Not yet run on a phone.