Skip to content

fix(pdf-manager): detect PDFRadioGroup fields instead of classifying as text - #660

Merged
kydecker merged 1 commit into
namesakefyi:mainfrom
nnhhoang:fix/659-pdf-radiogroup-detection
Jun 24, 2026
Merged

fix(pdf-manager): detect PDFRadioGroup fields instead of classifying as text#660
kydecker merged 1 commit into
namesakefyi:mainfrom
nnhhoang:fix/659-pdf-radiogroup-detection

Conversation

@nnhhoang

Copy link
Copy Markdown
Contributor

Summary

The PDF Manager at /pdf-manager was classifying PDFRadioGroup fields as text. The detection in extractFieldsFromBytes only special-cased PDFCheckBox and treated everything else as text, so radio groups got the wrong type and were shown with the text icon (noticed in #656, the first uploaded form that contains radio groups).

Changes

  • pdf-manager/lib/pdf.ts – add a small fieldType() helper that maps PDFCheckBoxcheckbox, PDFRadioGroupradio, and everything else → text, and add "radio" to PdfFieldInfo["type"].
  • pdf-manager/src/types.ts – add "radio" to Field["type"].
  • pdf-manager/src/components/FieldList.tsx – render a radio icon for radio fields.

The schema generation in lib/schema.ts already records the raw constructor.name, so generated schemas keep flagging these fields as PDFRadioGroup.

Testing

Built an in-memory PDF with a text field, a checkbox and a radio group, then ran extractFieldsFromBytes on it.

Before:

full_name    -> text
agree_terms  -> checkbox
sex_marker   -> text       (radio group — wrong)

After:

full_name    -> text
agree_terms  -> checkbox
sex_marker   -> radio

tsc --noEmit and biome check both pass.

Closes #659

…as text

The PDF Manager classified every non-checkbox field as "text", so radio groups were mislabeled and rendered with the text icon. Add explicit PDFRadioGroup detection via a fieldType() helper and a new "radio" field type, with a matching radio icon in the field list.

Closes namesakefyi#659

@kydecker kydecker left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Tested and everything works! Thank you for your contribution!

@kydecker
kydecker merged commit f7c40e9 into namesakefyi:main Jun 24, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PDF Manager does not handle detection of RadioGroup fields

2 participants