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
- An input and its datalist.
- Read the options, draw the chips, take a tap on one.
- 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
- The form.
- 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
- A select with a button and a
<selectedcontent>. - 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
- The canvas starts empty.
- 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.
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
- The heading group.
- Measure the characters, then widen the clip of each line.
How it works
- Data beside the picture.
input.list.options,input.type,document.titleand the rectangles of aRangeare read by script and decide what the canvas draws. None of them needs a readback of pixels. - Pieces. The large copy of the chosen option, the blurred field and the growing subtitle are draws of a whole element clipped to a box inside it.
- Canvas-drawn parts. The chips of the ring aren't elements. A
clickwhose target is the canvas is tested against their shapes. - Frames. Each demo asks for frames only while something moves.
Show the code
- Each demo starts when its section comes near the screen.
- The paint handler shared by the five canvases.
- Place a block, and draw one piece of it.
- 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.
input.list.optionsgives a canvas the suggestions of a<datalist>as data. The datalist is 0 by 0 px and has no picture. With thelistattribute removed,input.listis null and the browser opens no list of its own. The eight chips are canvas drawing: typing "ta" left 1 of 8 near the field, and a touch tap on the canvas where a chip is drawn set the field's value.- The picture of a
type="password"field holds dots. Two fields with different values of 13 characters gave the same pixels (247 dark pixels each), and a field of 12 characters gave 228, so the picture gives away the length and nothing else. The same value in a text field gave different pixels. The copy in the dark frame blurs the field only while its type isn'tpassword. <selectedcontent>held<b>Red</b> buoyin a box of 72 by 20 px and followedselect.value. In the demo its box is 101 by 32 px for Starboard and 81 by 32 px for Danger, and a draw of the select clipped to that box is shown 3.4 times as large. A touch tap on the drawn select opened its picker and a tap on an option chose it.- A
<title>moved into a canvas withdisplay: blockhas a box (340 by 150 px here), is in the picture, and still names the tab: after typing,document.titleand the drawn heading both read "Tide table for Oban". - A
Rangeover each character of the subtitle gave a rectangle for 61 of 61 characters, on 3 lines at 412 px. The subtitle is revealed by clips built from those rectangles, measured once with the group drawn flat. - One
contextlostevent stops the five canvases and shows the elements as plain HTML. The field gets itslistattribute back. Tested by dispatching the event. - Not verified: Chrome 159 on Android, the on-screen keyboard over the ring, a password manager's fill in the drawn field, and the picker of a customisable select on a phone.