fix(forms): contain long form codes in result badge and elevate design#728
Conversation
Form codes such as "6B Attachment" / "1A attachment" overflowed the
fixed-size result badge because the whole code rendered at text-2xl,
spilling the qualifier word out of the chip and over the title column.
Introduce a FormCodeBadge that splits the code into a prominent head
("6B") and a compact, contained qualifier sub-label ("Attachment"), and
scales the head font down as the code lengthens so longer codes never
clip. Applied consistently to the desktop results table and the mobile
cards.
Also elevate the results surface: a gradient, inset-shadowed badge chip,
a subtle accent rail and colour transition on row hover, and a hover
affordance on the Open control.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YJY1EzEXiBayz13Q6p2GwL
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)❌ Error creating Unit Test PR.
Comment |
|
Note Unit test generation is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it. Generating unit tests... This may take up to 20 minutes. |
The result-badge qualifier sub-label used an arbitrary text-[0.5rem] utility, which the strict type-scale gate rejects. --text-4xs is the named 0.5rem step, so swap to text-4xs for an identical rendering that stays on the design scale. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YJY1EzEXiBayz13Q6p2GwL
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/components/forms/forms-search-results-page.tsx`:
- Around line 107-118: Update the code rendering around the head and qualifier
spans so accessibility text exposes one complete code value in the intended
order, rather than concatenating adjacent fragments without separation. Preserve
the visual head/qualifier styling, mark those visual fragments as hidden from
the accessibility tree, and add a single accessible text node for the full code
so whole-code text queries continue to work.
🪄 Autofix (Beta)
❌ Autofix failed (check again to retry)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 68a61ddd-be1d-4ae7-8c9f-1c9bed5689e6
📒 Files selected for processing (1)
src/components/forms/forms-search-results-page.tsx
The badge renders the code as two visual spans (head + qualifier), which
assistive tech and text queries would read concatenated ("6BAttachment").
Add an sr-only node carrying the full "6B Attachment" string and mark the
decorative visual fragments aria-hidden, so the code is announced and
queryable as one value while the split styling is preserved.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YJY1EzEXiBayz13Q6p2GwL
|
Note Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it. Autofix skipped. No unresolved CodeRabbit review comments with fix instructions found. |
|
Request timed out after 900000ms (requestId=3291ab96-2396-4b60-adc8-30cfb087da60) |
Summary
6B Attachment/1A attachment— overflowed the fixed-size result badge because the whole string rendered attext-2xl, spilling the qualifier word out of the chip and over the title column (the reported screenshot).FormCodeBadgethat splits the code into a prominent head (6B) and a compact, fully-contained qualifier sub-label (ATTACHMENT), and scales the head font down as the code lengthens (1A→text-2xl,10A→text-xl, longer →text-base) so no code ever clips. Applied consistently to the desktop results table and the mobile cards.Opencontrol gains a hover affordance (border/fill on row hover, chevron nudge).text-4xstype-scale step (not an arbitrary size), keeping it on the design scale.Scope note: this is a purely presentational change to one component. It is classified clinical-risk only because the filename
forms-search-results-page.tsxcontains "search"; the Clinical Governance Preflight below is completed on that basis, and every listed invariant is genuinely untouched by the diff. No data, routing, retrieval, answer, ingestion, or governance behaviour changed, and test ids / rendered text are unchanged so existing specs keep passing.Verification
npx eslint src/components/forms/forms-search-results-page.tsx— cleannpx prettier --checkon the file — cleannode scripts/check-type-scale.mjs --strict— passes (no arbitrary font sizes)npx vitest run tests/forms.test.ts— 5/5 passnpm run typecheck— no new errors from this change (pre-existing failures are all missing@testing-library/@axe-core/playwrightdev deps intests/, identical on the base branch)attachmentquery, which surfaces the1A/6B/12C Attachmentforms — badge is fully contained at both breakpointsnpm run verify:uigate requires@axe-core/playwright, which is not installed in this environment; verified visually with the pre-installed Chromium viaplaywright-coreinstead.Risk and rollout
forms-search-results-page.tsx); no behavioural, data, or API surface touched.Clinical Governance Preflight
Clinical KB Database(sjrfecxgysukkwxsowpy)Notes
ATTACHMENT); on the narrower mobile chip it truncates with an ellipsis and carries atitletooltip with the full text.🤖 Generated with Claude Code
Summary by CodeRabbit