AI interfaces / Practical field guide / November 27, 2026

Why is that a button?

An AI draft can contain markup. Before you preview it, decide whether your interface is displaying text or asking the browser to build HTML.

In this field note · 6 sections
  1. Run the offline preview lab
  2. Inspect the preview boundary
  3. Make it your own
  4. Keep the evidence in scope
  5. Read the primary sources
  6. Get the practice and posting files

You ask an assistant to draft a review note. The draft includes <button>Approve</button>, perhaps as an example of a proposed interface. Your preview shows an actual button. That visible change happened at the rendering step: your page treated the string as HTML.

What we ran. Four authored strings in a local, offline browser lab. Chromium 147.0.7727.15 and WebKit 26.4, at 390px and 1440px viewport widths. No model, API, real draft, backend or approval workflow.
Cream portrait poster headed “Why is that a button?” with the serif subheading “An AI draft is still input.” Two contemporary ivory display panels sit on pale stone in soft daylight. The left panel, labeled TEXT, shows the literal printed markup <button>Approve</button>. The right panel, labeled HTML, holds a raised white button marked Approve. Amber paper branches lead from a foreground slip reading Same draft to both panels. Centered below: AI Anonymous, from JAB Systems, an amber rule, and jabsystems.io.
Original AI-generated conceptual still life: one string becomes printed text or a raised button. The lab's button has no action.

01 / Reproduce

Run the offline preview lab

Download the practice ZIP below and extract all three files into a fresh folder: preview.html, preview.js and README.md. Keep the JavaScript file beside the HTML file. Double-click preview.html, or open PowerShell in that folder and run:

Start-Process -FilePath .\preview.html

A current browser with JavaScript enabled is enough. There is no package installation, server, account or model download. The lab uses local files and makes no network requests.

Choose A button tag. The source string is <button type="button">Approve</button>. The left pane shows an Approve control. The right pane shows the angle brackets and tag text. Clicking the lab button does nothing: it has no handler, form or business operation.

Now select the other three fixtures. Our observed results:

Fixture     HTML elements   Text elements
button      1               0
emphasis    1               0
entity      0               0
lines       0               0

entity / HTML: Research & review
entity / text: Research &amp; review

The entity case matters even when no control appears. The source contains the literal characters &amp;. HTML parsing displays an ampersand; the text preview preserves the source characters. The two-line fixture stays on two lines in both panes because the lab deliberately uses white-space: pre-wrap.

02 / Inspect

Inspect the preview boundary

Open preview.js in a text editor. Inside renderSample, these are the two assignments:

htmlPreview.innerHTML = draft; // Demonstration only: fixed, inert fixtures above.
textPreview.textContent = draft;

MDN documents that innerHTML parses the assigned string as HTML. The lab's first assignment therefore creates an element from the button fixture. This is a demonstration line, not a preview implementation to connect to model responses. Its input is limited to four hardcoded strings.

For an ordinary div intended to display plain text, textContent sets textual content. It replaces the element's current children. Tags in the string remain text instead of becoming new page elements. That is the behavior the right pane demonstrates.

A request such as “return plain text” can describe what you want from a model. Your rendering choice still determines how the returned string enters the page. Inspect that handoff in a draft viewer, agent activity log or support-note preview you control.

03 / Adapt

Make it your own

In the lab's text-only preview editor, type this fictional note:

Please review <strong>before sending</strong>.

The literal tags should stay visible. No strong element should appear in that preview. Clear the editor and enter a different note: the current preview should be replaced, not appended. We checked both behaviors.

This is the complete editable-preview function from the supplied kit:

function renderCustom() {
  customPreview.textContent = draftInput.value;
}

To adapt it, use a dedicated ordinary display element for your draft, and assign your response string to that element's textContent. The input event in the kit updates the display as you type. Keep application buttons outside the draft display, with their behavior defined by your own interface.

If your application needs paragraphs or other structure, create those known elements in application code with document.createElement, then put draft text inside them. If you need rendered Markdown or HTML, design and review that richer rendering policy separately. This exercise does not supply a sanitizer.

04 / Evidence

Keep the evidence in scope

We ran the extracted kit as local files in Chromium and WebKit at mobile and desktop viewport sizes. All four fixture strings, element counts, literal text, entity behavior, custom-note adaptation, empty replacement and line-preserving CSS passed. We observed no HTTP requests or page errors, and the source files stayed unchanged. These were automated browser checks with emulated viewport sizes, not physical-device tests.

OWASP recommends textContent for displaying untrusted text in the DOM. This guide applies that narrow boundary to a fictional AI draft preview. It does not make arbitrary output trustworthy or validate the draft's claims.

Use an ordinary display element. This is not guidance for script or style contents, attributes, links, event handlers, or text that you later reinterpret as HTML. We did not test malicious payload coverage, a production integration, rich-text sanitization, authorization, model compliance, accuracy or performance. A button appearing in a preview also does not establish that any action was authorized or executed.

05 / Sources

Read the primary sources

Checked November 27, 2026. The browser documentation supports the rendering distinction; the measured results above come from our authored kit.

06 / Take it with you

Get the practice and posting files

The practice ZIP contains the offline lab and instructions. The posting ZIP contains the original graphic, teaser, alt text and canonical article URL. Social content is prepared for manual posting; it is not scheduled or published.

Did this help?

Please don't include personal or confidential information.

Ask or suggest

Please don't include personal or confidential information.

What would you like to send?

Share this post.

Found this useful? Pass it along. Download the artwork, add your own take, and tag @jabsystems.io so I can see your post.