Skip to content
open.blog documentation
open.blog

ADR 0382: The quote form is one plain accessible form, in a fence and a landing section, that renders nothing until quote requests are on

Context#

The form must be placeable on any page, work without JavaScript, and change nothing for a site that never turns it on.

Decision#

  • One form, written once in core (openblog_core::quote::form_html), used by both placements: a quote fence in a post, and a quote-form landing section (landing version 2, like business facts, ADR 0306). The Landing builder lists it as "Quote request form".
  • Settings. A versioned-free quote member of openblog.json: enabled (default false), endpoint (a path such as /api/quote, the default, or an https:// address; no queries, spaces or markup), and one line of notice. Absent or default is omitted from the written file.
  • Off renders nothing new. With enabled false the section produces no markup, no capability and no script, and a quote fence is not read as a form at all: it stays the ordinary code block it was before this feature existed, so an older post with a code block labelled quote builds and shows as it did. The output is byte for byte what it was. With enabled true a portable copy (feeds, export, syndication) never carries the form: the portable HTML, Markdown and text all drop the fence, and it is not a semantic fact the copy must keep.
  • Choices from the site. Towns come from serviceAreas (ADR 0314) in the order stated; services come from the services collection in the landing section, and from service: lines in the fence (the fence is rendered before the collection is known). With no list a field is a text box. Everything is escaped.
  • Plain HTML first. A <form method="post" enctype="multipart/form-data"> to <endpoint>/submit; every field has a visible <label>, hint and error element tied by aria-describedby; phone, email, name and town carry autocomplete; the honeypot is a labelled field moved off screen and hidden from assistive technology; the status line is role="status". The markup holds no request value, so no personal field can reach static output.
  • Enhancement. <ob-quote> (web/components/ob-quote.js and the pure ob-quote-model.js) fetches the form token, checks fields with the same rules as the server, says each problem beside its field and moves focus to the first, shrinks photos with a canvas to the server's 900 KB bound, shows upload progress, and replaces the form with a confirmation. It sends only to its own endpoint, stores nothing in the browser, and steps aside (the browser posts the form) when no token can be fetched.
  • Ids stay unique with a per-placement prefix, so a page may hold several forms.

Consequences#

The landing builder adds a section type (SECTION_TYPES is 16). Admin cannot yet show whether the hosted function is reachable; the setup guide says how to check. The accessibility contract is tested as markup (labels, descriptions, live region), in a real browser at 400 px, and with axe-core (a pinned dev dependency of tests/browser) for WCAG 2.1 A and AA in light and dark.

View this page's source