-
-
Notifications
You must be signed in to change notification settings - Fork 201
allow change close aria-label #385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,7 @@ const Panel = React.forwardRef<ContentRef, PanelProps>((props, ref) => { | |
ariaId, | ||
footer, | ||
closable, | ||
closeLabel, | ||
closeIcon, | ||
onClose, | ||
children, | ||
|
@@ -97,8 +98,8 @@ const Panel = React.forwardRef<ContentRef, PanelProps>((props, ref) => { | |
let closer: React.ReactNode; | ||
if (closable) { | ||
closer = ( | ||
<button type="button" onClick={onClose} aria-label="Close" className={`${prefixCls}-close`}> | ||
{closeIcon || <span className={`${prefixCls}-close-x`} />} | ||
<button type="button" onClick={onClose} title={closeLabel} aria-label={closeLabel ?? "Close"} className={`${prefixCls}-close`}> | ||
<span className={`${prefixCls}-close-x`} aria-hidden={closeLabel !== undefined ? true : undefined}>{closeIcon}</span> | ||
|
||
</button> | ||
); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be a prop with
closable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you mean make the closable prop an object with prop label?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it might look like this:
closable: boolean | { icon?: React.ReactNode, ariaLabel?: string }
+ oldcloseIcon
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ant-design/ant-design#42828