Lab
An accessible booking request form
This is a working demo of a short request form. A visitor can leave a name, a phone number or email, preferred dates, and which sample trip they have in mind. That is the kind of form a guide or trip site uses when the next step is a conversation, not a confirmed reservation.
It is modeled on the booking request used for the Cal Fly Guy site. It is not that form, it does not use that site's wording, and it is not a client result. This pattern is part of the Steelbridge Lab. To talk about a real project, use the contact form or call or text 541-602-0978.
The demo
Demo, nothing is sent.
The complete HTML, CSS, and JavaScript for this pattern are in the panels below. That is the full working source, not a snippet.
View code
<p class="bk-note"><strong>Demo, nothing is sent.</strong></p>
<form class="bk-form" id="bk-form" novalidate>
<div class="bk-field">
<label for="bk-name">Name</label>
<input id="bk-name" name="name" type="text" autocomplete="name" aria-describedby="bk-name-error">
<p class="bk-error" id="bk-name-error"></p>
</div>
<fieldset class="bk-contact" id="bk-contact" aria-describedby="bk-contact-note bk-contact-error">
<legend>Phone or email</legend>
<div class="bk-field">
<label for="bk-phone">Phone (optional)</label>
<input id="bk-phone" name="phone" type="tel" autocomplete="tel">
</div>
<div class="bk-field">
<label for="bk-email">Email (optional)</label>
<input id="bk-email" name="email" type="email" autocomplete="email" aria-describedby="bk-email-error">
<p class="bk-error" id="bk-email-error"></p>
</div>
<p class="bk-hint" id="bk-contact-note">Leave a phone number, an email, or both. One is required.</p>
<p class="bk-error" id="bk-contact-error"></p>
</fieldset>
<div class="bk-field">
<label for="bk-first">First preferred date</label>
<input id="bk-first" name="first" type="date" aria-describedby="bk-first-error">
<p class="bk-error" id="bk-first-error"></p>
</div>
<div class="bk-field">
<label for="bk-last">Last preferred date</label>
<input id="bk-last" name="last" type="date" aria-describedby="bk-last-error">
<p class="bk-error" id="bk-last-error"></p>
</div>
<div class="bk-field">
<label for="bk-trip">Which sample trip</label>
<select id="bk-trip" name="trip">
<option>Sample river one</option>
<option>Sample river two</option>
<option>Sample lake loop</option>
</select>
<p class="bk-hint">Sample options, not real trips.</p>
</div>
<div class="bk-field">
<label for="bk-note">Anything else (optional)</label>
<textarea id="bk-note" name="note" rows="4"></textarea>
</div>
<button class="bk-send" type="button" data-bk-send>Send a sample request</button>
<p class="bk-status" id="bk-status" role="status" aria-live="polite"></p>
</form>
<noscript>
<p><strong>Demo, nothing is sent.</strong> For a real project, use the <a href="/contact/">contact form</a> or call or text <a href="tel:+15416020978">541-602-0978</a>.</p>
</noscript>.bk-form { max-width: 28rem; }
.bk-note, .bk-status { margin: 0 0 0.8rem; }
.bk-status { min-height: 7.5rem; }
.bk-contact {
border: 1px solid var(--line, rgba(28, 25, 21, 0.14));
margin: 0 0 0.85rem;
padding: 0.5rem 0.8rem 0.7rem;
}
.bk-contact legend { font-weight: 500; padding: 0 0.2rem; }
.bk-field { margin: 0 0 0.85rem; }
.bk-field label, .bk-hint { display: block; }
.bk-hint { margin: 0.35rem 0 0; color: var(--ink-soft, #433c34); }
.bk-form input, .bk-form select, .bk-form textarea, .bk-send {
width: 100%;
max-width: 28rem;
min-height: 44px;
font: inherit;
color: var(--ink, #1c1915);
background: var(--cream, #faf6ef);
border: 1px solid var(--line, rgba(28, 25, 21, 0.14));
border-radius: 0.4rem;
padding: 0.4rem 0.6rem;
}
.bk-send {
width: auto;
min-width: 44px;
padding: 0.55rem 1.1rem;
border-radius: 999px;
background: var(--ink, #1c1915);
color: var(--cream, #faf6ef);
font-weight: 500;
cursor: pointer;
}
.bk-form input[aria-invalid="true"], .bk-form input[aria-invalid="true"]:focus-visible {
border-color: var(--ink, #1c1915);
outline: 2px solid var(--ink, #1c1915);
outline-offset: 2px;
}
.bk-error { min-height: 0; margin: 0.3rem 0 0; color: var(--ink, #1c1915); font-weight: 500; }
.bk-error:empty { display: none; }
@media (prefers-reduced-motion: reduce) {
.bk-form input, .bk-form select, .bk-form textarea, .bk-send { transition: none; }
}(function () {
var form = document.getElementById('bk-form');
if (!form) return;
var name = document.getElementById('bk-name');
var phone = document.getElementById('bk-phone');
var email = document.getElementById('bk-email');
var contact = document.getElementById('bk-contact');
var first = document.getElementById('bk-first');
var last = document.getElementById('bk-last');
var status = document.getElementById('bk-status');
function clearField(field, errorId) {
field.removeAttribute('aria-invalid');
var error = document.getElementById(errorId);
if (error) error.textContent = '';
}
function mark(field, errorId, message) {
field.setAttribute('aria-invalid', 'true');
var error = document.getElementById(errorId);
if (error) error.textContent = message;
}
function syncMin() {
if (first.value) last.min = first.value;
else last.removeAttribute('min');
}
first.addEventListener('input', syncMin);
first.addEventListener('change', syncMin);
function validate() {
clearField(name, 'bk-name-error');
clearField(contact, 'bk-contact-error');
clearField(email, 'bk-email-error');
clearField(first, 'bk-first-error');
clearField(last, 'bk-last-error');
var firstInvalid = null;
function take(field) {
if (!firstInvalid) firstInvalid = field;
}
if (!name.value.trim()) {
mark(name, 'bk-name-error', 'Enter a name.');
take(name);
}
var phoneEmpty = !phone.value.trim();
var emailEmpty = !email.value.trim();
if (phoneEmpty && emailEmpty) {
mark(contact, 'bk-contact-error', 'Enter a phone number or an email. One is required.');
take(phone);
}
if (!emailEmpty && email.validity.typeMismatch) {
mark(email, 'bk-email-error', 'Enter an email address that includes a name and a domain.');
take(email);
}
if (!first.value) {
mark(first, 'bk-first-error', 'Choose a first preferred date.');
take(first);
}
if (!last.value) {
mark(last, 'bk-last-error', 'Choose a last preferred date.');
take(last);
} else if (first.value && last.value < first.value) {
mark(last, 'bk-last-error', 'The last preferred date cannot be before the first.');
take(last);
}
if (firstInvalid) {
firstInvalid.focus();
return;
}
status.replaceChildren();
var strong = document.createElement('strong');
strong.textContent = 'Demo, nothing is sent.';
status.append(strong, ' The fields are unchanged, and no request has gone anywhere. You can keep editing them. For a real project, use the ');
var contactLink = document.createElement('a');
contactLink.href = '/contact/';
contactLink.textContent = 'contact form';
status.append(contactLink, ' or call or text ');
var tel = document.createElement('a');
tel.href = 'tel:+15416020978';
tel.textContent = '541-602-0978';
status.append(tel, '.');
}
form.addEventListener('submit', function (event) {
event.preventDefault();
validate();
});
form.querySelector('[data-bk-send]').addEventListener('click', validate);
})();What problem this solves
People planning a trip are often not ready to pay or to lock in a single slot. They want to say when they are free, what they are hoping for, and how to reach them. A phone number on the page still matters. A request form is for the visitor who would rather write than call, and it gives the business a clear note to return.
A confirmed booking calendar is a different tool. It needs live availability, rules about holds or deposits, and usually a way to take payment. This pattern does not do that work and should not look as if it does. The visible line "Demo, nothing is sent" is there so no one leaves this page thinking a trip was requested.
Why it's built this way
The fields are native inputs: text, telephone, email, date, a select, and a textarea, each with a visible label. The browser then provides the keyboard behavior, the mobile date picker, and the accessible name. A custom calendar grid is often where keyboard and screen-reader support falls apart, and it adds motion that has to be turned off. Placeholders are not a substitute for labels. Required fields are stated in text, not only with a colored asterisk.
Phone and email are separate optional fields (type="tel" and type="email"), with a visible note that one of them is required. A single "phone or email" box cannot use those types correctly, so the browser would not offer the right keyboard or built-in format checks. Name uses autocomplete="name", phone uses autocomplete="tel", and email uses autocomplete="email", so a returning visitor can fill them from the browser.
The last preferred date cannot be before the first. Its earliest allowed value is tied to the first date, and if someone still enters a later-to-earlier range, the error text is tied to the last date field.
When a required field is missing, or the date range is invalid, focus moves to the first invalid field so the visitor can fix it, and the error is tied to that field in the markup. Those errors are not also announced through the live region, so a screen reader does not hear the same problem twice. The live region is used only for the successful demo status, after the button is used correctly, and it does not announce on every keystroke.
Without JavaScript, every field stays visible and can be read and filled. The demo still does not send, because there is no form action to send to. A short noscript note repeats "Demo, nothing is sent" and points to the contact form and 541-602-0978. The button only updates the on-page status when the script is present.
This page makes no network call from the form. A live form on a real project would submit to that project's own server and use spam protection. How that kind of form is scoped, tested on staging, and launched is described on How we work.
Accessibility decisions and how they will be tested
These are the rules the build should follow. They have not been tested yet. Testing happens on staging, before any request to publish.
- The words "Demo, nothing is sent" are visible before anyone uses the button and again after a valid demo submit, not only inside a live region.
- Every field has a visible label. Error text is tied to the field that needs a fix, including the last preferred date and the phone-or-email requirement.
- Dates use the native date input, not a custom calendar. The last date's minimum is tied to the first date.
- Name, phone, and email use autocomplete.
- Focus is never trapped. After a validation error, focus moves to the first invalid field. The live region does not also announce that error.
- The successful demo status uses a polite live region. Copy buttons on the code panels have clear names, such as "Copy HTML".
- Scrollable code blocks can be focused with the keyboard (
tabindex="0") and have an accessible label. - Contrast should meet WCAG AA in the Lab's light and dark themes, without using color alone to mark an error or a completed state. Targets are 44 pixels, the same size used sitewide.
- The system reduced-motion setting is honored. This demo should not add its own animated date interface.
Test plan (to be run on staging, not claimed as done): a keyboard-only pass through the fields, the button, the date-range error, the missing contact error, and the code panels; the same pass with VoiceOver in Safari and with NVDA in a common Windows browser, checking that a validation error is not heard twice; the page with JavaScript turned off; the page with reduced motion on; and both Lab themes. A Lighthouse accessibility score can be recorded as a check. It is not the pass.
Known limits
Native date fields look and behave differently in Safari, Chrome, and Firefox, and on a phone compared with a desktop. That difference is accepted, because it keeps the native date field the browser already provides.
The two date fields are only preferred dates. They do not handle time zones, blocked days, or "I'm flexible." The last date cannot be before the first, but the fields do not block out unavailable days. The trip list is a static sample, labeled as such. Because nothing is sent, this demo cannot show server-side validation, a confirmation message from a real inbox, or spam protection.
Phone and email are optional on their own, with a visible rule that one is required. A browser will check the format of whichever field is filled; it will not, by itself, enforce that at least one of the two has a value. That check is in the page script when JavaScript is on, and it is explained in the visible note when it is not.
Screen-reader support for input type="date" is uneven from one browser to another. That is a reason to keep the visible label and a plain hint, and not to replace the native date field with a custom grid. This page does not publish speed scores for the demo, and it does not claim results from any client form.
When you wouldn't use it
Do not use this pattern when the visitor has to pick a live, confirmed slot. That needs real availability. Do not use it when payment or a deposit is part of the same step. And do not add a trip-specific request form when a phone number and a general contact form are enough; the extra fields then get in the way.
Do not restyle a native date field so heavily that its accessible name or calendar is lost. And do not ship this demo's no-submit behavior on a production form, or place an unlabeled demo on a client site where someone could think a real request went through.
Questions about this demo
Does this form send a booking request?
No. The line "Demo, nothing is sent" is visible before you use the form and again after you press the button. This page has no form action and makes no network call.
Is this the form on the Cal Fly Guy site?
No. It is modeled on that booking request, as a pattern, and it does not use that site's wording. The live form on that project is separate. This pattern lives in the Lab. The process around a form like this on a real site is on How we work.