diff --git a/src/components/forms/Fieldset/Fieldset.test.tsx b/src/components/forms/Fieldset/Fieldset.test.tsx index 7482443f1e..17d1c4efe0 100644 --- a/src/components/forms/Fieldset/Fieldset.test.tsx +++ b/src/components/forms/Fieldset/Fieldset.test.tsx @@ -16,6 +16,17 @@ describe('Fieldset component', () => { expect(queryByText('My Fieldset')).toBeInTheDocument() }) + it('accepts fieldset intrinsic props', () => { + const { queryByText } = render( +
My Fieldset
+ ) + + const myFieldset = queryByText('My Fieldset') + + expect(myFieldset).toBeInTheDocument() + expect(myFieldset).toHaveAttribute('aria-live', 'polite') + }) + describe('renders uswds classes', () => { it('renders legend with class usa-legend by default', () => { const { queryByTestId, getByText } = render( diff --git a/src/components/forms/Fieldset/Fieldset.tsx b/src/components/forms/Fieldset/Fieldset.tsx index 7815474623..6e46eaca38 100644 --- a/src/components/forms/Fieldset/Fieldset.tsx +++ b/src/components/forms/Fieldset/Fieldset.tsx @@ -19,7 +19,8 @@ export const Fieldset = ({ className, legendSrOnly, legendStyle = 'default', -}: FieldsetProps): React.ReactElement => { + ...fieldsetProps +}: FieldsetProps & JSX.IntrinsicElements['fieldset']): React.ReactElement => { const classes = classnames('usa-fieldset', className) if (legendSrOnly) { @@ -35,7 +36,7 @@ export const Fieldset = ({ }) return ( -
+
{legend && {legend}} {children}