Skip to content

Commit fae753d

Browse files
committed
Cluster name show validation message when typing characters
1 parent 8a0e737 commit fae753d

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

Diff for: libs/ui-lib/lib/common/components/ui/formik/RichInputField.tsx

+10-4
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@ import {
55
FormGroup,
66
HelperTextItem,
77
TextInput,
8-
HelperText as PFHelperText,
8+
HelperText,
99
HelperTextItemProps,
1010
Popover,
1111
PopoverPosition,
1212
InputGroup,
1313
Button,
1414
InputGroupItem,
1515
FormHelperText,
16-
HelperText,
1716
} from '@patternfly/react-core';
1817
import { CheckCircleIcon } from '@patternfly/react-icons/dist/js/icons/check-circle-icon';
1918
import { CheckIcon } from '@patternfly/react-icons/dist/js/icons/check-icon';
@@ -58,7 +57,7 @@ export const RichValidation: React.FC<RichValidationProps> = ({
5857
richValidationMessages,
5958
}) => {
6059
return (
61-
<PFHelperText component="ul" className="rich-input__rules">
60+
<HelperText component="ul" className="rich-input__rules">
6261
{Object.keys(richValidationMessages).map((key) => {
6362
const variant = getHelperTextVariant(richValidationMessages[key], value, error);
6463
return (
@@ -67,7 +66,7 @@ export const RichValidation: React.FC<RichValidationProps> = ({
6766
</HelperTextItem>
6867
);
6968
})}
70-
</PFHelperText>
69+
</HelperText>
7170
);
7271
};
7372

@@ -99,6 +98,12 @@ const RichInputField: React.FC<RichInputFieldPropsProps> = React.forwardRef(
9998
const fieldId = getFieldId(props.name, 'input', idPostfix);
10099
const isValid = !(touched && error?.length);
101100

101+
React.useEffect(() => {
102+
if (value !== '') {
103+
setPopoverOpen(true);
104+
}
105+
}, [value]);
106+
102107
return (
103108
<FormGroup
104109
id={`form-control__${fieldId}`}
@@ -128,6 +133,7 @@ const RichInputField: React.FC<RichInputFieldPropsProps> = React.forwardRef(
128133
shouldOpen={() => setPopoverOpen(true)}
129134
aria-label="validation popover"
130135
position={PopoverPosition.top}
136+
withFocusTrap={false}
131137
bodyContent={
132138
<RichValidation
133139
value={value}

0 commit comments

Comments
 (0)