Skip to content

Commit db874b1

Browse files
Barsnesmimarz
authored andcommitted
add closeButtonTitle to modal header
1 parent ee3f104 commit db874b1

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

packages/react/src/components/Modal/ModalHeader.tsx

+19-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ export type ModalHeaderProps = {
1515
* @default true
1616
*/
1717
closeButton?: boolean;
18+
/**
19+
* The title of the close button.
20+
* @default 'close modal'
21+
*/
22+
closeButtonTitle?: string;
23+
/**
24+
* The subtitle of the modal.
25+
*/
1826
subtitle?: string;
1927
/**
2028
* Change the default rendered element for the one passed as a child, merging their props and behavior.
@@ -25,7 +33,15 @@ export type ModalHeaderProps = {
2533

2634
export const ModalHeader = forwardRef<HTMLDivElement, ModalHeaderProps>(
2735
(
28-
{ closeButton = true, children, subtitle, asChild, className, ...rest },
36+
{
37+
closeButton = true,
38+
closeButtonTitle = 'close modal',
39+
children,
40+
subtitle,
41+
asChild,
42+
className,
43+
...rest
44+
},
2945
ref,
3046
) => {
3147
const Component = asChild ? Slot : 'div';
@@ -60,8 +76,9 @@ export const ModalHeader = forwardRef<HTMLDivElement, ModalHeaderProps>(
6076
autoFocus
6177
icon={true}
6278
className='ds-modal__header__button'
79+
title={closeButtonTitle}
6380
>
64-
<XMarkIcon title='close modal' fontSize='1.5em' />
81+
<XMarkIcon title={closeButtonTitle} fontSize='1.5em' />
6582
</Button>
6683
)}
6784
</Component>

0 commit comments

Comments
 (0)