diff --git a/src/collections/Form/FormButton.js b/src/collections/Form/FormButton.js index 2ae1de7cf5..cf4a5f816f 100644 --- a/src/collections/Form/FormButton.js +++ b/src/collections/Form/FormButton.js @@ -10,13 +10,15 @@ import FormField from './FormField' * @see Button * @see Form */ -function FormButton(props) { +const FormButton = React.forwardRef((props, ref) => { const { control } = props const rest = getUnhandledProps(FormButton, props) const ElementType = getElementType(FormButton, props) - return -} + return +}) + +FormButton.displayName = 'FormButton' FormButton.propTypes = { /** An element type to render as (string or function). */ diff --git a/src/collections/Form/FormCheckbox.js b/src/collections/Form/FormCheckbox.js index 4f734c7aa9..f98dad56cc 100644 --- a/src/collections/Form/FormCheckbox.js +++ b/src/collections/Form/FormCheckbox.js @@ -10,13 +10,15 @@ import FormField from './FormField' * @see Checkbox * @see Form */ -function FormCheckbox(props) { +const FormCheckbox = React.forwardRef((props, ref) => { const { control } = props const rest = getUnhandledProps(FormCheckbox, props) const ElementType = getElementType(FormCheckbox, props) - return -} + return +}) + +FormCheckbox.displayName = 'FormCheckbox' FormCheckbox.propTypes = { /** An element type to render as (string or function). */ diff --git a/src/collections/Form/FormGroup.js b/src/collections/Form/FormGroup.js index 335c1c2a4b..cf2e16df18 100644 --- a/src/collections/Form/FormGroup.js +++ b/src/collections/Form/FormGroup.js @@ -15,7 +15,7 @@ import { * A set of fields can appear grouped together. * @see Form */ -function FormGroup(props) { +const FormGroup = React.forwardRef((props, ref) => { const { children, className, grouped, inline, unstackable, widths } = props const classes = cx( @@ -30,11 +30,13 @@ function FormGroup(props) { const ElementType = getElementType(FormGroup, props) return ( - + {children} ) -} +}) + +FormGroup.displayName = 'FormGroup' FormGroup.propTypes = { /** An element type to render as (string or function). */ diff --git a/test/specs/collections/Form/FormButton-test.js b/test/specs/collections/Form/FormButton-test.js index 5b62ac7257..539a65d364 100644 --- a/test/specs/collections/Form/FormButton-test.js +++ b/test/specs/collections/Form/FormButton-test.js @@ -15,4 +15,6 @@ describe('FormButton', () => { .find('FormField') .should.have.prop('control', Button) }) + + common.forwardsRef(FormButton, { tagName: 'button' }) }) diff --git a/test/specs/collections/Form/FormCheckbox-test.js b/test/specs/collections/Form/FormCheckbox-test.js index 985e6f9c58..c152284b11 100644 --- a/test/specs/collections/Form/FormCheckbox-test.js +++ b/test/specs/collections/Form/FormCheckbox-test.js @@ -14,4 +14,6 @@ describe('FormCheckbox', () => { .find('FormField') .should.have.prop('control', Checkbox) }) + + common.forwardsRef(FormCheckbox, { tagName: 'input' }) }) diff --git a/test/specs/collections/Form/FormGroup-test.js b/test/specs/collections/Form/FormGroup-test.js index c9bd6828b9..c97294b0a7 100644 --- a/test/specs/collections/Form/FormGroup-test.js +++ b/test/specs/collections/Form/FormGroup-test.js @@ -16,4 +16,6 @@ describe('FormGroup', () => { common.propKeyOnlyToClassName(FormGroup, 'grouped') common.propKeyOnlyToClassName(FormGroup, 'inline') common.propKeyOnlyToClassName(FormGroup, 'unstackable') + + common.forwardsRef(FormGroup) })