From 3c5003373c8d4bfe125f80adcf6b36b411b94a90 Mon Sep 17 00:00:00 2001 From: kay delaney <45561153+kaydelaney@users.noreply.github.com> Date: Tue, 2 Nov 2021 15:27:07 +0000 Subject: [PATCH] A11y: Fix various fastpass accessibility issues (#41154) --- public/app/features/admin/OrgRolePicker.tsx | 4 ++- public/app/features/admin/UserCreatePage.tsx | 7 ++-- public/app/features/admin/UserOrgs.tsx | 11 +++--- public/app/features/admin/UserProfile.tsx | 6 +++- .../alerting/unified/AmRoutes.test.tsx | 6 ++-- .../unified/components/CollapseToggle.tsx | 7 +++- .../unified/components/DynamicTable.tsx | 1 + .../components/amroutes/AmRootRouteForm.tsx | 7 +++- .../amroutes/AmRoutesExpandedForm.tsx | 36 ++++++++++++++++--- .../components/amroutes/AmRoutesTable.tsx | 4 +-- .../receivers/form/ChannelSubForm.tsx | 4 ++- .../components/rule-editor/AlertTypeStep.tsx | 1 + .../rule-editor/AnnotationKeyInput.tsx | 4 ++- .../rule-editor/AnnotationsField.tsx | 7 +++- .../components/rule-editor/ConditionField.tsx | 1 + .../rule-editor/GrafanaConditionsStep.tsx | 20 ++++++++--- .../components/rule-editor/SelectWIthAdd.tsx | 4 +++ .../unified/components/rules/ActionIcon.tsx | 3 +- .../rules/RuleDetailsDataSources.tsx | 2 +- 19 files changed, 104 insertions(+), 31 deletions(-) diff --git a/public/app/features/admin/OrgRolePicker.tsx b/public/app/features/admin/OrgRolePicker.tsx index 2e75fd0adf5..bae10a5d5b9 100644 --- a/public/app/features/admin/OrgRolePicker.tsx +++ b/public/app/features/admin/OrgRolePicker.tsx @@ -6,14 +6,16 @@ interface Props { value: OrgRole; disabled?: boolean; 'aria-label'?: string; + inputId?: string; onChange: (role: OrgRole) => void; } const options = Object.keys(OrgRole).map((key) => ({ label: key, value: key })); -export const OrgRolePicker: FC = ({ value, onChange, 'aria-label': ariaLabel, ...restProps }) => ( +export const OrgRolePicker: FC = ({ value, onChange, 'aria-label': ariaLabel, inputId, ...restProps }) => ( + - + - + = ({ navModel }) => { error={errors.password ? 'Password is required and must contain at least 4 characters' : undefined} > value.trim() !== '' && value.length >= 4, })} diff --git a/public/app/features/admin/UserOrgs.tsx b/public/app/features/admin/UserOrgs.tsx index 3deed4f2ce1..558682f03f8 100644 --- a/public/app/features/admin/UserOrgs.tsx +++ b/public/app/features/admin/UserOrgs.tsx @@ -151,12 +151,15 @@ class UnThemedOrgRow extends PureComponent { const canChangeRole = contextSrv.hasPermission(AccessControlAction.OrgUsersRoleUpdate); const canRemoveFromOrg = contextSrv.hasPermission(AccessControlAction.OrgUsersRemove); + const inputId = `${org.name}-input`; return ( - {org.name} + + + {isChangingRole ? ( - + ) : ( {org.role} @@ -257,10 +260,10 @@ export class AddToOrgModal extends PureComponent - + - + diff --git a/public/app/features/admin/UserProfile.tsx b/public/app/features/admin/UserProfile.tsx index 50be1842748..74501ceb012 100644 --- a/public/app/features/admin/UserProfile.tsx +++ b/public/app/features/admin/UserProfile.tsx @@ -275,12 +275,16 @@ export class UserProfileRow extends PureComponent; } + const inputId = `${label}-input`; return ( - {label} + + + {this.state.editing ? ( = ({ isCollapsed, onToggle, className, te const styles = useStyles(getStyles); return ( - diff --git a/public/app/features/alerting/unified/components/DynamicTable.tsx b/public/app/features/alerting/unified/components/DynamicTable.tsx index e26bf183ca2..9beee9941c1 100644 --- a/public/app/features/alerting/unified/components/DynamicTable.tsx +++ b/public/app/features/alerting/unified/components/DynamicTable.tsx @@ -96,6 +96,7 @@ export const DynamicTable = ({ {isExpandable && (
= ({ ( onChange(mapSelectValueToString(value))} options={receivers} + menuShouldPortal /> )} control={control} @@ -139,10 +141,11 @@ export const AmRoutesExpandedForm: FC = ({ onCancel, /> - + setOverrideGrouping((overrideGrouping) => !overrideGrouping)} /> @@ -152,6 +155,7 @@ export const AmRoutesExpandedForm: FC = ({ onCancel, ( = ({ onCancel, )} setOverrideTimings((overrideTimings) => !overrideTimings)} /> @@ -189,7 +194,13 @@ export const AmRoutesExpandedForm: FC = ({ onCancel,
( - + )} control={control} name="groupWaitValue" @@ -205,6 +216,7 @@ export const AmRoutesExpandedForm: FC = ({ onCancel, className={formStyles.input} onChange={(value) => onChange(mapSelectValueToString(value))} options={timeOptions} + aria-label="Group wait type" /> )} control={control} @@ -223,7 +235,13 @@ export const AmRoutesExpandedForm: FC = ({ onCancel,
( - + )} control={control} name="groupIntervalValue" @@ -239,6 +257,7 @@ export const AmRoutesExpandedForm: FC = ({ onCancel, className={formStyles.input} onChange={(value) => onChange(mapSelectValueToString(value))} options={timeOptions} + aria-label="Group interval type" /> )} control={control} @@ -257,7 +276,13 @@ export const AmRoutesExpandedForm: FC = ({ onCancel,
( - + )} control={control} name="repeatIntervalValue" @@ -274,6 +299,7 @@ export const AmRoutesExpandedForm: FC = ({ onCancel, menuPlacement="top" onChange={(value) => onChange(mapSelectValueToString(value))} options={timeOptions} + aria-label="Repeat interval type" /> )} control={control} diff --git a/public/app/features/alerting/unified/components/amroutes/AmRoutesTable.tsx b/public/app/features/alerting/unified/components/amroutes/AmRoutesTable.tsx index f253a99bb4f..c3543129a35 100644 --- a/public/app/features/alerting/unified/components/amroutes/AmRoutesTable.tsx +++ b/public/app/features/alerting/unified/components/amroutes/AmRoutesTable.tsx @@ -76,7 +76,7 @@ export const AmRoutesTable: FC = ({ return ( { const newRoutes = [...routes]; diff --git a/public/app/features/alerting/unified/components/receivers/form/ChannelSubForm.tsx b/public/app/features/alerting/unified/components/receivers/form/ChannelSubForm.tsx index eb4a917b680..e8a79e091f4 100644 --- a/public/app/features/alerting/unified/components/receivers/form/ChannelSubForm.tsx +++ b/public/app/features/alerting/unified/components/receivers/form/ChannelSubForm.tsx @@ -72,17 +72,19 @@ export function ChannelSubForm({ const mandatoryOptions = notifier?.options.filter((o) => o.required); const optionalOptions = notifier?.options.filter((o) => !o.required); + const contactPointTypeInputId = `contact-point-type-${pathPrefix}`; return (
- + ( onChange(v?.value)} diff --git a/public/app/features/alerting/unified/components/rule-editor/AnnotationKeyInput.tsx b/public/app/features/alerting/unified/components/rule-editor/AnnotationKeyInput.tsx index 270cb9b7f67..7451454b145 100644 --- a/public/app/features/alerting/unified/components/rule-editor/AnnotationKeyInput.tsx +++ b/public/app/features/alerting/unified/components/rule-editor/AnnotationKeyInput.tsx @@ -10,9 +10,10 @@ interface Props { value?: string; width?: number; className?: string; + 'aria-label'?: string; } -export const AnnotationKeyInput: FC = ({ value, existingKeys, ...rest }) => { +export const AnnotationKeyInput: FC = ({ value, existingKeys, 'aria-label': ariaLabel, ...rest }) => { const annotationOptions = useMemo( (): SelectableValue[] => Object.values(Annotation) @@ -23,6 +24,7 @@ export const AnnotationKeyInput: FC = ({ value, existingKeys, ...rest }) return ( { ( - + )} control={control} rules={{ required: { value: !!annotations[index]?.value, message: 'Required.' } }} diff --git a/public/app/features/alerting/unified/components/rule-editor/ConditionField.tsx b/public/app/features/alerting/unified/components/rule-editor/ConditionField.tsx index 030b500ccab..f4341f35132 100644 --- a/public/app/features/alerting/unified/components/rule-editor/ConditionField.tsx +++ b/public/app/features/alerting/unified/components/rule-editor/ConditionField.tsx @@ -48,6 +48,7 @@ export const ConditionField: FC = () => { render={({ field: { onChange, ref, ...field } }) => ( + @@ -79,7 +87,7 @@ export const GrafanaConditionsStep: FC = () => { invalid={!!errors.evaluateFor?.message} validationMessageHorizontalOverflow={true} > - +
@@ -92,11 +100,12 @@ export const GrafanaConditionsStep: FC = () => { /> {showErrorHandling && ( <> - + ( onChange(value?.value)} @@ -105,11 +114,12 @@ export const GrafanaConditionsStep: FC = () => { name="noDataState" /> - + ( onChange(value?.value)} diff --git a/public/app/features/alerting/unified/components/rule-editor/SelectWIthAdd.tsx b/public/app/features/alerting/unified/components/rule-editor/SelectWIthAdd.tsx index 34ba01e31b2..34b11dc1203 100644 --- a/public/app/features/alerting/unified/components/rule-editor/SelectWIthAdd.tsx +++ b/public/app/features/alerting/unified/components/rule-editor/SelectWIthAdd.tsx @@ -13,6 +13,7 @@ interface Props { onCustomChange?: (custom: boolean) => void; width?: number; disabled?: boolean; + 'aria-label'?: string; } export const SelectWithAdd: FC = ({ @@ -26,6 +27,7 @@ export const SelectWithAdd: FC = ({ onCustomChange, disabled = false, addLabel = '+ Add new', + 'aria-label': ariaLabel, }) => { const [isCustom, setIsCustom] = useState(custom); @@ -43,6 +45,7 @@ export const SelectWithAdd: FC = ({ if (isCustom) { return ( = ({ return (