Add labels and ids to various elements (#4527)
This commit is contained in:
parent
60e97e2e9f
commit
e02c692fd9
6 changed files with 28 additions and 27 deletions
|
@ -108,7 +108,7 @@ const ValueInput = ({
|
||||||
control={control}
|
control={control}
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<Select
|
<Select
|
||||||
id={`${attribute.id}-value`}
|
toggleId={`${attribute.id}-value`}
|
||||||
className="kc-attribute-value-selectable"
|
className="kc-attribute-value-selectable"
|
||||||
name={`${name}[${rowIndex}].value`}
|
name={`${name}[${rowIndex}].value`}
|
||||||
chipGroupProps={{
|
chipGroupProps={{
|
||||||
|
@ -116,7 +116,6 @@ const ValueInput = ({
|
||||||
expandedText: t("common:hide"),
|
expandedText: t("common:hide"),
|
||||||
collapsedText: t("common:showRemaining"),
|
collapsedText: t("common:showRemaining"),
|
||||||
}}
|
}}
|
||||||
toggleId={`group-${name}`}
|
|
||||||
onToggle={(open) => toggleValueSelect(rowIndex, open)}
|
onToggle={(open) => toggleValueSelect(rowIndex, open)}
|
||||||
isOpen={isValueOpenArray[rowIndex]}
|
isOpen={isValueOpenArray[rowIndex]}
|
||||||
variant={SelectVariant.typeahead}
|
variant={SelectVariant.typeahead}
|
||||||
|
@ -139,6 +138,7 @@ const ValueInput = ({
|
||||||
className="value-input"
|
className="value-input"
|
||||||
defaultValue={attribute.value}
|
defaultValue={attribute.value}
|
||||||
data-testid="attribute-value-input"
|
data-testid="attribute-value-input"
|
||||||
|
aria-label={t("common:value")}
|
||||||
{...register(`${name}.${rowIndex}.value`)}
|
{...register(`${name}.${rowIndex}.value`)}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
@ -181,12 +181,8 @@ export const KeyBasedAttributeInput = ({
|
||||||
>
|
>
|
||||||
<Thead>
|
<Thead>
|
||||||
<Tr>
|
<Tr>
|
||||||
<Th id="key" width={40}>
|
<Th width={40}>{t("key")}</Th>
|
||||||
{t("key")}
|
<Th width={40}>{t("value")}</Th>
|
||||||
</Th>
|
|
||||||
<Th id="value" width={40}>
|
|
||||||
{t("value")}
|
|
||||||
</Th>
|
|
||||||
</Tr>
|
</Tr>
|
||||||
</Thead>
|
</Thead>
|
||||||
<Tbody>
|
<Tbody>
|
||||||
|
@ -199,10 +195,9 @@ export const KeyBasedAttributeInput = ({
|
||||||
control={control}
|
control={control}
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<Select
|
<Select
|
||||||
id={`${name}[${rowIndex}].key`}
|
toggleId={`${name}[${rowIndex}].key`}
|
||||||
className="kc-attribute-key-selectable"
|
className="kc-attribute-key-selectable"
|
||||||
name={`${name}[${rowIndex}].key`}
|
name={`${name}[${rowIndex}].key`}
|
||||||
toggleId={`group-${name}`}
|
|
||||||
onToggle={(open) => toggleKeySelect(rowIndex, open)}
|
onToggle={(open) => toggleKeySelect(rowIndex, open)}
|
||||||
isOpen={isKeyOpenArray[rowIndex]}
|
isOpen={isKeyOpenArray[rowIndex]}
|
||||||
variant={SelectVariant.typeahead}
|
variant={SelectVariant.typeahead}
|
||||||
|
@ -235,12 +230,13 @@ export const KeyBasedAttributeInput = ({
|
||||||
selectableValues={selectableValues}
|
selectableValues={selectableValues}
|
||||||
resources={resources}
|
resources={resources}
|
||||||
/>
|
/>
|
||||||
<Td key="minus-button" id={`kc-minus-button-${rowIndex}`}>
|
<Td>
|
||||||
<Button
|
<Button
|
||||||
id={`minus-button-${rowIndex}`}
|
id={`${name}-minus-button-${rowIndex}`}
|
||||||
variant="link"
|
variant="link"
|
||||||
className="kc-attributes__minus-icon"
|
className="kc-attributes__minus-icon"
|
||||||
onClick={() => remove(rowIndex)}
|
onClick={() => remove(rowIndex)}
|
||||||
|
aria-label={t("common:remove")}
|
||||||
>
|
>
|
||||||
<MinusCircleIcon />
|
<MinusCircleIcon />
|
||||||
</Button>
|
</Button>
|
||||||
|
@ -251,7 +247,7 @@ export const KeyBasedAttributeInput = ({
|
||||||
<Td>
|
<Td>
|
||||||
<Button
|
<Button
|
||||||
aria-label={t("addAttribute")}
|
aria-label={t("addAttribute")}
|
||||||
id="plus-icon"
|
id={`${name}-plus-icon`}
|
||||||
variant="link"
|
variant="link"
|
||||||
className="kc-attributes__plus-icon"
|
className="kc-attributes__plus-icon"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
|
|
@ -97,7 +97,7 @@ export const ScopePicker = ({ clientId }: { clientId: string }) => {
|
||||||
setSearch("");
|
setSearch("");
|
||||||
field.onChange([]);
|
field.onChange([]);
|
||||||
}}
|
}}
|
||||||
aria-label={t("authorizationScopes")}
|
typeAheadAriaLabel={t("authorizationScopes")}
|
||||||
>
|
>
|
||||||
{renderScopes(scopes)}
|
{renderScopes(scopes)}
|
||||||
</Select>
|
</Select>
|
||||||
|
|
|
@ -14,15 +14,19 @@ type CertificateDisplayProps = {
|
||||||
keyInfo?: CertificateRepresentation;
|
keyInfo?: CertificateRepresentation;
|
||||||
};
|
};
|
||||||
|
|
||||||
const CertificateDisplay = ({ id, keyInfo }: CertificateDisplayProps) => (
|
const CertificateDisplay = ({ id, keyInfo }: CertificateDisplayProps) => {
|
||||||
|
const { t } = useTranslation("clients");
|
||||||
|
return (
|
||||||
<KeycloakTextArea
|
<KeycloakTextArea
|
||||||
readOnly
|
readOnly
|
||||||
rows={5}
|
rows={5}
|
||||||
id={id}
|
id={id}
|
||||||
data-testid="certificate"
|
data-testid="certificate"
|
||||||
value={keyInfo?.certificate}
|
value={keyInfo?.certificate}
|
||||||
|
aria-label={t("certificate")}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
};
|
||||||
|
|
||||||
export const Certificate = ({ keyInfo, plain = false }: CertificateProps) => {
|
export const Certificate = ({ keyInfo, plain = false }: CertificateProps) => {
|
||||||
const { t } = useTranslation("clients");
|
const { t } = useTranslation("clients");
|
||||||
|
|
|
@ -36,7 +36,7 @@ export const GeneratedCodeTab = ({
|
||||||
<KeycloakTextArea id={`text-area-${label}`} rows={20} value={text} />
|
<KeycloakTextArea id={`text-area-${label}`} rows={20} value={text} />
|
||||||
</CodeBlock>
|
</CodeBlock>
|
||||||
) : (
|
) : (
|
||||||
<EmptyState variant="large">
|
<EmptyState variant="large" id={label}>
|
||||||
<Title headingLevel="h4" size="lg">
|
<Title headingLevel="h4" size="lg">
|
||||||
{t(`${label}No`)}
|
{t(`${label}No`)}
|
||||||
</Title>
|
</Title>
|
||||||
|
|
|
@ -99,7 +99,7 @@ export const ClientSelect = ({
|
||||||
field.onChange(value.toString());
|
field.onChange(value.toString());
|
||||||
setOpen(false);
|
setOpen(false);
|
||||||
}}
|
}}
|
||||||
aria-label={t(label!)}
|
typeAheadAriaLabel={t(label!)}
|
||||||
>
|
>
|
||||||
{convert(clients)}
|
{convert(clients)}
|
||||||
</Select>
|
</Select>
|
||||||
|
|
|
@ -32,6 +32,7 @@ export const MultiLineInput = ({
|
||||||
isDisabled = false,
|
isDisabled = false,
|
||||||
defaultValue,
|
defaultValue,
|
||||||
stringify = false,
|
stringify = false,
|
||||||
|
id,
|
||||||
...rest
|
...rest
|
||||||
}: MultiLineInputProps) => {
|
}: MultiLineInputProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
@ -77,7 +78,7 @@ export const MultiLineInput = ({
|
||||||
}, [register]);
|
}, [register]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<div id={id}>
|
||||||
{fields.map((value, index) => (
|
{fields.map((value, index) => (
|
||||||
<Fragment key={index}>
|
<Fragment key={index}>
|
||||||
<InputGroup>
|
<InputGroup>
|
||||||
|
@ -114,6 +115,6 @@ export const MultiLineInput = ({
|
||||||
)}
|
)}
|
||||||
</Fragment>
|
</Fragment>
|
||||||
))}
|
))}
|
||||||
</>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue