diff --git a/packages/@react-spectrum/label/src/Field.tsx b/packages/@react-spectrum/label/src/Field.tsx index dfd31ca0b55..1df1dc3a6eb 100644 --- a/packages/@react-spectrum/label/src/Field.tsx +++ b/packages/@react-spectrum/label/src/Field.tsx @@ -39,7 +39,7 @@ function Field(props: SpectrumFieldProps, ref: RefObject) { showErrorIcon, contextualHelp, children, - labelProps, + labelProps = {}, // Not every component that uses supports help text. descriptionProps = {}, errorMessageProps = {}, @@ -52,6 +52,11 @@ function Field(props: SpectrumFieldProps, ref: RefObject) { let hasHelpText = !!description || errorMessage && validationState === 'invalid'; let contextualHelpId = useId(); + let fallbackLabelPropsId = useId(); + if (label && contextualHelp && !labelProps.id) { + labelProps.id = fallbackLabelPropsId; + } + let labelWrapperClass = classNames( labelStyles, 'spectrum-Field',