diff --git a/crates/xfa/src/pdf.rs b/crates/xfa/src/pdf.rs index 0904c89304..67c4193f49 100644 --- a/crates/xfa/src/pdf.rs +++ b/crates/xfa/src/pdf.rs @@ -174,8 +174,9 @@ impl Emitter<'_> { ff |= 1; } // Required, which viewers outline when they highlight a form's fields. A radio button's - // flags are its group's: the group takes it below. - if w.required && !matches!(w.kind, WidgetKind::Radio { .. }) { + // flags are its group's: the group takes it below. A push button keeps no value (ISO + // 32000-2 §12.7.5.2.2), so there is nothing it could be required to hold. + if w.required && !matches!(w.kind, WidgetKind::Radio { .. } | WidgetKind::Button { .. }) { ff |= 1 << 1; } let mut top_level = true; diff --git a/crates/xfa/src/tests.rs b/crates/xfa/src/tests.rs index 33b1c0aede..9ad12f82e9 100644 --- a/crates/xfa/src/tests.rs +++ b/crates/xfa/src/tests.rs @@ -345,7 +345,8 @@ fn rendering_into_the_pdf_replaces_the_placeholder_page_and_adds_fields() { /// Required field, which viewers outline when they highlight a form's fields: a radio group on the /// group field, its buttons' flags being the group's (a button of its own that must be chosen /// makes the group required too). `nullTest="warning"` only recommends a value, -/// so it, like no test, leaves the field optional. +/// so it, like no test, leaves the field optional. A push button keeps no value (ISO 32000-2 +/// §12.7.5.2.2), so it is never required. #[test] fn fields_that_must_be_filled_in_are_required() { let xdp = r##" @@ -355,6 +356,7 @@ fn fields_that_must_be_filled_in_are_required() { 10 +