@jonmilner/ui 0.11.15 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,4 +2,4 @@ import { SearchFieldInputProps } from "../SearchField/client.mjs";
2
2
  import "../SearchField/index.mjs";
3
3
  import "./index.mjs";
4
4
  import { ComponentPropsWithRef } from "react";
5
- export type ColorFieldInputProps = Pick<ComponentPropsWithRef<"input">, keyof SearchFieldInputProps>;
5
+ export type ColorFieldInputProps = Pick<ComponentPropsWithRef<"input">, keyof SearchFieldInputProps | "aria-placeholder">;
@@ -1,3 +1,3 @@
1
1
  import "./index.mjs";
2
2
  import { ComponentPropsWithRef } from "react";
3
- export type SearchFieldInputProps = Pick<ComponentPropsWithRef<"input">, "ref" | "id" | "autoFocus" | "autoComplete" | "spellCheck" | "enterKeyHint" | "maxLength" | "onKeyDown" | "aria-atomic" | "aria-busy" | "aria-controls" | "aria-current" | "aria-details" | "aria-flowto" | "aria-keyshortcuts" | "aria-live" | "aria-owns" | "aria-relevant" | "aria-roledescription" | "aria-activedescendant" | "aria-autocomplete" | "aria-placeholder">;
3
+ export type SearchFieldInputProps = Pick<ComponentPropsWithRef<"input">, "ref" | "id" | "autoFocus" | "autoComplete" | "spellCheck" | "enterKeyHint" | "maxLength" | "onKeyDown" | "aria-atomic" | "aria-busy" | "aria-controls" | "aria-current" | "aria-details" | "aria-flowto" | "aria-keyshortcuts" | "aria-live" | "aria-owns" | "aria-relevant" | "aria-roledescription" | "aria-activedescendant" | "aria-autocomplete">;
@@ -2,7 +2,7 @@ import { StyleProps } from "../Box/base.mjs";
2
2
  import { SearchFieldInputProps } from "../SearchField/client.mjs";
3
3
  import "../SearchField/index.mjs";
4
4
  import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
5
- export type TextFieldInputProps = Pick<ComponentPropsWithRef<"input">, keyof SearchFieldInputProps | "inputMode" | "minLength" | "pattern">;
5
+ export type TextFieldInputProps = Pick<ComponentPropsWithRef<"input">, keyof SearchFieldInputProps | "aria-placeholder" | "inputMode" | "minLength" | "pattern">;
6
6
  export type TextFieldProps = StyleProps & {
7
7
  className?: string;
8
8
  defaultValue?: string;
@@ -27,7 +27,7 @@ A form field for a search query: an `<input type="search">` (role `searchbox`) w
27
27
  - `disabled` uses the native `disabled`: the input leaves the tab order and does not submit, with a dashed border. `required` sets the native `required`.
28
28
  - `name` submits the query with its form. An uncontrolled field does not follow a native form reset; control it if the form resets.
29
29
  - Style props, `className` and `style` go to the `Field` around the label, input and messages, not to the input.
30
- - `inputProps` reach the input: `ref`, `id`, `autoFocus`, `autoComplete`, `spellCheck`, `enterKeyHint`, `maxLength`, `onKeyDown`, and only the `aria-*` valid on a search box (ADR 0093, 0108): `aria-controls`, `aria-activedescendant`, `aria-autocomplete`, `aria-placeholder`, `aria-details`, `aria-keyshortcuts`, `aria-owns`, `aria-flowto`, `aria-current`, `aria-roledescription`, `aria-busy`, `aria-live`, `aria-atomic` and `aria-relevant`. `label` owns the name, Field owns `aria-invalid`, `aria-describedby` and `aria-errormessage`, and `disabled` and `required` own their state, so those, `aria-readonly`, `aria-hidden` and the single-line input's `aria-multiline` are not among them. `aria-expanded` and `aria-haspopup` are not either: a search box with a popup list is a Combobox. The type closes the set, so an object literal with another `aria-*` is a type error; nothing strips one at runtime. Hint with `placeholder`, not `aria-placeholder`: the input has a native placeholder.
30
+ - `inputProps` reach the input: `ref`, `id`, `autoFocus`, `autoComplete`, `spellCheck`, `enterKeyHint`, `maxLength`, `onKeyDown`, and only the `aria-*` valid on a search box (ADR 0093, 0108, 0148): `aria-controls`, `aria-activedescendant`, `aria-autocomplete`, `aria-details`, `aria-keyshortcuts`, `aria-owns`, `aria-flowto`, `aria-current`, `aria-roledescription`, `aria-busy`, `aria-live`, `aria-atomic` and `aria-relevant`. `label` owns the name, Field owns `aria-invalid`, `aria-describedby` and `aria-errormessage`, and `disabled` and `required` own their state, so those, `aria-readonly`, `aria-hidden` and the single-line input's `aria-multiline` are not among them. Neither is `aria-placeholder`: hint with `placeholder`, since the input has a native placeholder and ARIA says not to set both. `aria-expanded` and `aria-haspopup` are not either: a search box with a popup list is a Combobox. The type closes the set, so an object literal with another `aria-*` is a type error; nothing strips one at runtime.
31
31
  - A consumer `onKeyDown` runs before the field's own. Escape still clears unless that handler called `event.preventDefault()`. A prevented Escape also propagates, so a surrounding Dialog closes on it.
32
32
  - A consumer `ref` gets the input, and the clear button still returns focus to it. A consumer `id` takes over from Field's generated one at hydration, and the label follows it.
33
33
  - Wrapping the field in a search landmark (`<search>` or `role="search"`, with the form around it) is the page's job, not the field's.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "./manifest.schema.json",
3
3
  "package": "@jonmilner/ui",
4
- "version": "0.11.15",
4
+ "version": "0.12.0",
5
5
  "components": [
6
6
  {
7
7
  "name": "AlertDialog",
@@ -0,0 +1,22 @@
1
+ # 0.12.0
2
+
3
+ SearchField's `inputProps` no longer take `aria-placeholder` (decision 0148): the field's own `placeholder` prop sets the input's native placeholder, and WAI-ARIA says not to set `aria-placeholder` beside one, since a screen reader can then announce the hint twice or a hint that is not on screen. TextField, Textarea and ColorField still take it.
4
+
5
+ ## Find
6
+
7
+ In the app's source (`*.ts`, `*.tsx`), every `aria-placeholder`: regex `aria-placeholder`. Keep the matches that reach a SearchField's `inputProps`, inline or through an object passed by name (one built elsewhere escapes the type check, so search, don't rely on `pnpm typecheck` alone). Leave matches on TextField, Textarea or ColorField, which still take the key.
8
+
9
+ ## Replace
10
+
11
+ ```tsx
12
+ // before
13
+ <SearchField label="Search issues" inputProps={{ "aria-placeholder": "Title or number" }} />
14
+ // after: the native placeholder is the hint, shown and announced
15
+ <SearchField label="Search issues" placeholder="Title or number" />
16
+ ```
17
+
18
+ If the SearchField already has a `placeholder`, delete the `aria-placeholder` key and keep the `placeholder` text that should appear on screen.
19
+
20
+ ## Verify
21
+
22
+ `pnpm typecheck` passes, and every match the regex above still finds reaches a TextField, Textarea or ColorField, none a SearchField.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jonmilner/ui",
3
- "version": "0.11.15",
3
+ "version": "0.12.0",
4
4
  "bin": {
5
5
  "ui-doctor": "./dist/cli/ui-doctor.mjs"
6
6
  },