Skip to content

Commit 99c339d

Browse files
committed
fix: add missing labels
KBDEV-1500
1 parent 90c851e commit 99c339d

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

src/components/DetailChip/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function DefaultPopupComponent<D extends object>(props: DefaultPopupComponentPro
5555
</Typography>
5656
{getLink && getLink(retrievedDetails) && (
5757
<Link target="_blank" to={getLink(retrievedDetails)}>
58-
<IconButton>
58+
<IconButton aria-label="open in new tab">
5959
<OpenInNewIcon />
6060
</IconButton>
6161
</Link>

src/components/FormField/TextArrayField/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ const TextArrayField = (props: TextArrayFieldProps) => {
153153
const isDeleted = deleted.includes(text);
154154
const props = {
155155
deleteIcon: isDeleted
156-
? <RefreshIcon />
157-
: <CancelIcon />,
156+
? <RefreshIcon aria-label="restore value" />
157+
: <CancelIcon aria-label="delete value" />,
158158
onDelete: isDeleted
159159
? () => handleRestore(text)
160160
: () => handleDelete(text),

src/components/RadioSelect/index.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
Radio,
1212
} from '@mui/material';
1313
import isObject from 'lodash.isobject';
14-
import React, { ReactNode } from 'react';
14+
import React, { ReactNode, useId } from 'react';
1515

1616
interface Option<V = unknown> {
1717
label: string;
@@ -56,15 +56,17 @@ interface RadioSelectProps<V = unknown> {
5656
function RadioSelect<V>({
5757
options, onChange, className, label, value, optionToKey = (o) => asOption(o).key, name,
5858
}: RadioSelectProps<V>) {
59+
const id = useId();
5960
return (
6061
<MenuList className={`radio-select ${className}`}>
6162
{label && (<FormLabel>{label}</FormLabel>)}
6263
{options.map((optionOrValue) => {
6364
const option = asOption(optionOrValue);
6465
const checked = Boolean(value === option.value);
66+
const key = optionToKey(option);
6567
return (
6668
<MenuItem
67-
key={optionToKey(option)}
69+
key={key}
6870
className="radio-option"
6971
onClick={() => {
7072
onChange?.({ target: { name, value: option.value } });
@@ -74,12 +76,13 @@ function RadioSelect<V>({
7476
<Radio
7577
checked={checked}
7678
inputProps={{
79+
'aria-labelledby': `${id}-${key}-label`,
7780
[('data-testid' as any)]: `radio-option__${optionToKey(option)}`,
7881
}}
7982
/>
8083
<ListItemText
8184
primary={option.label}
82-
primaryTypographyProps={{ className: 'radio-option__title' }}
85+
primaryTypographyProps={{ className: 'radio-option__title', id: `${id}-${key}-label` }}
8386
secondary={option.caption || ''}
8487
secondaryTypographyProps={{ className: 'radio-option__caption' }}
8588
/>

0 commit comments

Comments
 (0)