Skip to content

feat: Add field tips to AutoForm fields - #889

Merged
aXenDeveloper merged 3 commits into
canaryfrom
claude/auto-form-field-tips
Oct 19, 2026
Merged

aXenDeveloper merged 3 commits into
canaryfrom
claude/auto-form-field-tips

Conversation

@aXenDeveloper

Copy link
Copy Markdown
Owner

Description

What?

Added a tip prop to AutoForm fields that displays a question-mark help button beside the label. Clicking, hovering, or keyboard interaction opens a popover with additional help text. This complements the existing label and description props by providing optional, on-demand help content.

Key changes:

  • New AutoFormTip component that renders a help button with popover
  • Updated AutoFormLabel to support the tip prop and render the help button
  • Added tip prop to all built-in field components (input, textarea, checkbox, switch, select, etc.)
  • Updated AutoFormArray to support tips on the array itself
  • Multi-language fields show one help button in the UI language, not per language
  • Form focus logic skips the help button when focusing invalid fields after submit
  • Added comprehensive tests and documentation

Why?

Help text can be verbose and distract from the main form. By separating it into optional tips, users can quickly scan the form and only read detailed help when needed. This improves UX for both simple and complex forms.

The implementation ensures:

  • Help buttons never interfere with form submission or control interaction
  • Keyboard and screen reader users can access tips easily
  • Multi-language forms keep tips in the UI language while editing different languages
  • Empty tip values render no button, allowing conditional tips like tip={isAdmin && t("admin.tip")}

Test Plan

Added comprehensive test coverage in auto-form-tip.test.tsx:

  • Verifies no button renders for empty/undefined tips
  • Tests opening/closing behavior via click and keyboard
  • Ensures clicking help buttons doesn't submit forms or toggle checkboxes/switches
  • Validates focus lands on the control, not the help button, after failed submit
  • Confirms multi-language fields show one help button, not per language
  • Tests array fields preserve both array and row tips

Unit tests for hasTipContent utility verify correct detection of empty vs. populated tips.

https://claude.ai/code/session_01BLmESfGxr2efqTJwy3fPHX

Every built-in AutoForm field accepts `tip`, shown as a question-mark
button beside the label that opens a popover on hover, click/tap or
keyboard. Fields without `tip` render exactly as before.

- AutoFormTip (Base UI Popover with openOnHover), localized accessible name
- AutoFormLabel keeps the help button a sibling of the label, so it never
  focuses or toggles the control
- Multi-language fields show one tip; AutoFormArray puts it in the legend
- Failed submit never focuses a help button
- Docs section and live example

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BLmESfGxr2efqTJwy3fPHX
- hasTipContent empty/non-empty table
- no button without tip; click opens, Escape closes; no `tip` attribute leak
- tip click neither submits nor toggles a checkbox or switch
- failed submit focuses the control, never the help button
- one tip per multi-language field; array and row tips, group named by label

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BLmESfGxr2efqTJwy3fPHX
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T09:17:57.614176Z 01cf4f3 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit 01cf4f3.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1ea165175a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +66 to +70
<PopoverContent
className="w-max max-w-[min(--spacing(72),var(--available-width))] gap-2 p-3 leading-relaxed text-pretty wrap-break-word"
side="top"
>
{children}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Add an accessible name to the tip dialog

When a screen-reader user opens any field tip, this PopoverContent is exposed as a dialog, but it contains only anonymous body content and has no PopoverTitle, aria-label, or aria-labelledby. The trigger's accessible name does not name the popup, so assistive technology announces an unnamed dialog; give the popup an accessible name and associate the tip body as its description.

AGENTS.md reference: AGENTS.md:L59-L60

Useful? React with 👍 / 👎.

Comment on lines +45 to +51
render(
<AutoForm
fields={[
{
id: "title",
component: props => (
<AutoFormInput {...props} label="Title" tip={tip} />

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Remove the prohibited AutoForm component tests

The newly added DOM suite renders AutoForm and built-in form fields throughout, starting with this case, even though the repository explicitly forbids UI component tests of AutoForm and form fields. Remove this suite rather than adding costly happy-dom coverage at the prohibited layer; the separate pure hasTipContent test can remain.

AGENTS.md reference: AGENTS.md:L114-L116

Useful? React with 👍 / 👎.

@aXenDeveloper aXenDeveloper changed the title Add field tips to AutoForm fields feat: Add field tips to AutoForm fields Oct 19, 2026
@github-actions github-actions Bot added the 💡 Feature A new feature label Oct 19, 2026
@aXenDeveloper
aXenDeveloper merged commit f581501 into canary Oct 19, 2026
7 checks passed
@aXenDeveloper
aXenDeveloper deleted the claude/auto-form-field-tips branch October 19, 2026 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💡 Feature A new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants