Files
chatkit/demo/field-form.html
CatoandClaude 3a3384c5b8 feat(field): DictationField can stand in for a form's text area (0.27.0) (#85)
* feat(field): DictationField in a form — name, error, submit keys, field-level focus (0.27.0)

Loki's 36 hand-made text areas could not become DictationField because a
form needs props the field did not pass through (measured: onKeyDown 10,
maxLength 9, id 7, autoFocus 7, disabled 5, onBlur 2, onFocus 1, name 2,
spellCheck 1, plus validation errors on the field).

- name, autoFocus, readOnly (no mic, no Improve, no Undo)
- invalid / error: aria-invalid, the frame in --ck-danger, the error under
  the field as role=alert, error and hint linked with aria-describedby
- onKeyDown, and onSubmit owned by the package: Cmd/Ctrl+Enter in a text
  area, Enter in one line; never while composing, disabled, read-only or
  during a take
- onFocus / onBlur for the whole field: the mic is not a blur, and a blur
  during a take is held until its words reach onValueChange
- inputProps for spellCheck, autoComplete, inputMode, aria-*, data-*;
  managed props win
- Enter in Improve's instruction box applies it

Tests: server markup in render.test.js; a Strict Mode form fixture in
browser-field.mjs at 390px and desktop, light and dark, and 320px with an
error shown. Version 0.27.0 (0.26.0 is already on npm).

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmsyW2aAn78GgfRxyn5

* fix(field): Improve at work is not a blur; Enter never sends the native form mid-take

Review findings on the 0.27.0 DictationField form props:
- Improve disables its own box and button while it works, so focus fell off
  with nowhere to go and the field reported a blur. Improve at work now
  counts as busy, like a take.
- With onSubmit, Enter in a one-line field (Shift+Enter, during a take,
  read-only) no longer runs the browser's implicit form post.
- error="" or 0 is no error: no danger frame, no aria-invalid with nothing said.
- inputProps.style no longer reaches the box (16px text is the package's).
- The form fixture loads a development bundle, so Strict Mode is exercised.
- README and CHANGELOG: a held blur is not reported if the host unmounts
  the field; the hint's aria-describedby is the one markup change.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmsyW2aAn78GgfRxyn5

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 08:58:49 +01:00

22 lines
618 B
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>DictationField in a form</title>
<link rel="stylesheet" href="../node_modules/@bitbaum/design-tokens/tokens.css" />
<link rel="stylesheet" href="../styles.css" />
<style>
body {
margin: 0;
font: 16px system-ui;
}
</style>
</head>
<body>
<div id="form-fixture"></div>
<!-- The development build: Strict Mode only runs effects twice there. -->
<script src="dist/demo-dev.js"></script>
</body>
</html>