mirror of
https://github.com/ansible/awx.git
synced 2026-03-26 13:25:02 -02:30
add aria label prop for alert modal pf component
This commit is contained in:
@@ -8,6 +8,8 @@ import {
|
|||||||
InfoCircleIcon,
|
InfoCircleIcon,
|
||||||
TimesCircleIcon,
|
TimesCircleIcon,
|
||||||
} from '@patternfly/react-icons';
|
} from '@patternfly/react-icons';
|
||||||
|
import { withI18n } from '@lingui/react';
|
||||||
|
import { t } from '@lingui/macro';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
const Header = styled.div`
|
const Header = styled.div`
|
||||||
@@ -17,7 +19,8 @@ const Header = styled.div`
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export default function AlertModal({
|
function AlertModal({
|
||||||
|
i18n,
|
||||||
isOpen = null,
|
isOpen = null,
|
||||||
title,
|
title,
|
||||||
variant,
|
variant,
|
||||||
@@ -60,14 +63,15 @@ export default function AlertModal({
|
|||||||
const customHeader = (
|
const customHeader = (
|
||||||
<Header>
|
<Header>
|
||||||
{variant ? variantIcons[variant] : null}
|
{variant ? variantIcons[variant] : null}
|
||||||
<Title size="2xl" headingLevel="h2">{title}</Title>
|
<Title id="alert-modal-header-label" size="2xl" headingLevel="h2">{title}</Title>
|
||||||
</Header>
|
</Header>
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
header={customHeader}
|
header={customHeader}
|
||||||
|
aria-label={i18n._(t`Alert modal`)}
|
||||||
|
aria-labelledby="alert-modal-header-label"
|
||||||
isOpen={Boolean(isOpen)}
|
isOpen={Boolean(isOpen)}
|
||||||
variant="small"
|
variant="small"
|
||||||
title={title}
|
title={title}
|
||||||
@@ -77,3 +81,5 @@ export default function AlertModal({
|
|||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default withI18n()(AlertModal);
|
||||||
|
|||||||
Reference in New Issue
Block a user