File tree 1 file changed +17
-1
lines changed
packages/calcite-components/src/components/functional
1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,19 @@ export const CSS = {
16
16
validationContainer : "validation-container" ,
17
17
} ;
18
18
19
+ const setValidationReference = ( {
20
+ referenceElement,
21
+ ref,
22
+ } : {
23
+ referenceElement : HTMLDivElement ;
24
+ ref ?: ( el : HTMLDivElement ) => void ;
25
+ } ) : HTMLDivElement => {
26
+ if ( ref ) {
27
+ ref ( referenceElement ) ;
28
+ }
29
+ return referenceElement ;
30
+ } ;
31
+
19
32
export const Validation = ( {
20
33
scale,
21
34
status,
@@ -24,7 +37,10 @@ export const Validation = ({
24
37
message,
25
38
ref,
26
39
} : ValidationProps ) : TemplateResult => (
27
- < div class = { CSS . validationContainer } ref = { ref } >
40
+ < div
41
+ class = { CSS . validationContainer }
42
+ ref = { ( referenceElement ) : HTMLDivElement => setValidationReference ( { referenceElement, ref } ) }
43
+ >
28
44
< calcite-input-message ariaLive = "polite" icon = { icon } id = { id } scale = { scale } status = { status } >
29
45
{ message }
30
46
</ calcite-input-message >
You can’t perform that action at this time.
0 commit comments