diff --git a/src/Input.tsx b/src/Input.tsx index 4aa21beb..ea2b5f71 100644 --- a/src/Input.tsx +++ b/src/Input.tsx @@ -101,6 +101,7 @@ export const Input = memo( })(); const messageId = `${inputId}-desc-error`; + const messagesGroupId = `${inputId}-messages-group`; return (
{ - switch (state) { - case "error": - return "fr-error-text"; - case "success": - return "fr-valid-text"; - case "info": - return "fr-info-text"; - } - assert>(); - })() - ), - classes.message - )} - > - {stateRelatedMessage} -

- )} +
+ {state !== "default" && ( +

{ + switch (state) { + case "error": + return "fr-error-text"; + case "success": + return "fr-valid-text"; + case "info": + return "fr-info-text"; + } + assert>(); + })() + ), + classes.message + )} + > + {stateRelatedMessage} +

+ )} +
); }) diff --git a/src/Select.tsx b/src/Select.tsx index d860c034..cece5bfe 100644 --- a/src/Select.tsx +++ b/src/Select.tsx @@ -64,6 +64,7 @@ export const Select = memo( })(); const stateDescriptionId = `select-${useId()}-desc`; + const messagesGroupId = `${selectId}-messages-group`; return (
{children} - {state !== "default" && ( -

{ - switch (state) { - case "error": - return "fr-error-text"; - case "success": - return "fr-valid-text"; - } - assert>(false); - })() - )} - > - {stateRelatedMessage} -

- )} +
+ {state !== "default" && ( +

{ + switch (state) { + case "error": + return "fr-error-text"; + case "success": + return "fr-valid-text"; + } + assert>(false); + })() + )} + > + {stateRelatedMessage} +

+ )} +
); })