only show the placeholder when the field isn't readonly (#32975)

fixes: #32657

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
This commit is contained in:
Erik Jan de Wit 2024-10-11 09:36:47 +02:00 committed by GitHub
parent e999b8fd82
commit 1ca56e6dd9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -17,12 +17,18 @@ export const TextComponent = (props: UserProfileFieldProps) => {
id={attribute.name}
data-testid={attribute.name}
type={type}
placeholder={label(
props.t,
attribute.annotations?.["inputTypePlaceholder"] as string,
attribute.name,
attribute.annotations?.["inputOptionLabelsI18nPrefix"] as string,
)}
placeholder={
attribute.readOnly
? ""
: label(
props.t,
attribute.annotations?.["inputTypePlaceholder"] as string,
attribute.name,
attribute.annotations?.[
"inputOptionLabelsI18nPrefix"
] as string,
)
}
readOnly={attribute.readOnly}
isRequired={isRequired}
{...form.register(fieldName(attribute.name))}