Skip to content

Commit a34185b

Browse files
qq9340100claude
andauthored
docs(spec): FieldWidgetPropsSchema 的 required/error JSDoc 不再教 objectui#3222 裁掉的双份显示 (#6062)
* docs(spec): FieldWidgetPropsSchema 的 required/error JSDoc 不再教 objectui#3222 裁掉的双份显示 `required` 原文教 widget「indicate required state visually」、`error` 原文教 widget「display the error in its UI」——这两件事正是 objectui#3222 裁定反对、 并已在 objectui PR #3289 落地的:必填标记 `*` 归宿主 label,校验消息文案归宿主 `FormMessage`,widget 只把 `error` 当信号驱动 `aria-invalid`,再画一遍就是双份显示。 仅改 JSDoc 散文;`.describe()`、键名与类型一律不动(#5055 的 ADR-0049 决策面不受影响)。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011M7UwH25Unfi73UHim7ajY * chore: 重触发 CI —— 平台冻结窗口的 rerun attempt 卡死预排队,换 head 重新调度 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011M7UwH25Unfi73UHim7ajY --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 8a2ea6c commit a34185b

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

packages/spec/src/ui/widget.zod.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -458,13 +458,27 @@ export const FieldWidgetPropsSchema = lazySchema(() => z.object({
458458

459459
/**
460460
* Whether the field is required.
461-
* Widget should indicate required state visually and validate accordingly.
461+
*
462+
* The required MARKER (the `*`) is owned by the host's field label, not by
463+
* the widget — a widget that draws its own produces two markers for one
464+
* field (objectui#3222, landed in objectui#3289). Validation is likewise the
465+
* host's: it owns the form state that decides whether the field passes.
466+
*
467+
* A widget reflects the state on the control it renders, via
468+
* `aria-required` — `AriaAttributes` already declares that key, so this
469+
* needs no additional contract key (objectui#3290).
462470
*/
463471
required: z.boolean().default(false).describe('Required field flag'),
464472

465473
/**
466-
* Validation error message to display.
467-
* When present, widget should display the error in its UI.
474+
* The active validation message for this field; `undefined` while the field
475+
* is valid.
476+
*
477+
* Consumed as a SIGNAL, not as content: a widget reads it only to drive
478+
* `aria-invalid` on the control it renders, which is the one element the
479+
* host cannot reach. The message TEXT is rendered by the host's form message
480+
* slot (`FormMessage` in objectui); a widget that renders it too
481+
* double-displays it (objectui#3222, landed in objectui#3289).
468482
*/
469483
error: z.string().optional().describe('Validation error message'),
470484

0 commit comments

Comments
 (0)