Repository navigation
fix(field): don't render an empty label element - #898
Conversation
|
LGTM! Review notes
|
|
✅ Approved — The fix is small and correct, and regression tests cover it. The changeset wording now matches the code, and nothing is left open. The decision is advisory: this comment never approves, blocks or requests changes on the pull request. ✅ All checks passed🔒 Security: ✅ LGTMThis is a UI and accessibility fix and has no security impact. 📖 AGENTS.md: ✅ LGTMThe pull request includes the changeset that 📋 Code Quality: ✅ LGTMThe ⚡ Performance: ✅ LGTMNo performance concerns. 📝 Documentation: ✅ LGTM
Reviewed commit: |
commit: |
🚀 Deploying Preview to Cloudflare 🚀Preview URL: https://mrothenberg-fix-tag-input-empty-label-kumo-docs.design-engineering.workers.dev (commit 8fb72d9)This URL reflects your latest Preview deploymentPreview Deployments by commit
|
📐 Bundle SizeConsumer fixtures bundled against
npm tarball: 565 files, 1.56 MB packed, 7.30 MB unpacked.
|
4ebdd2c to
c1e6d05
Compare

Problem
Fieldalways rendered its<label>, even with no label content.Input,InputAreaandTagInputwrap themselves inFieldwhenever they have a description or error, so without alabelthey rendered an empty<label>. That caused two problems:TagInputhits this as soon as an entry failsvalidateValue.aria-labelledbyat the empty label, which overridesaria-label.<Input aria-label="Name" description="…" />was announced with no name.Fix
Fieldskips the<label>only when it would render nothing:labelandlabelTooltipare each a value React renders as nothing (undefined,null, a boolean or""), and there is no "(optional)" indicator. Every other case renders exactly as before, includinglabel={0}, tooltip-only and optional-only labels, andhideLabel.TagInputno longer passeslabel ?? "".Regression check
Only
Input,InputAreaandTagInputever giveFieldan empty label. The other wrappers (Select,Combobox,Autocomplete,InputGroup,SensitiveInput,Switch) only useFieldwith a label.No docs demo renders those three with a description or error but no label, so no docs screenshots change.
Unit suite: 1312 passed. That's the baseline of 1298 plus 14 new tests; no existing test changed.
The 10 new bug tests fail on
main. The new "keeps the label" tests pass on bothmainand this branch.Browser suite: same results as
main. Its failures (Select truncating trigger visual, Flow connectors) also fail onmain, and a clipboard-dependent TagInput paste test is flaky under parallel runs. That test renders noField, and it passes 5/5 in isolation.tsc, lint and format are clean.Reviews
bonk has reviewed the change
automated review not possible because: small change to one condition; regression coverage added and existing suites compared against main
Tests
Tests included/updated
Automated tests not possible - manual testing has been completed as follows:
Additional testing not necessary because: