-
Notifications
You must be signed in to change notification settings - Fork 183
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
allow change close aria-label #385
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> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The change to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. because of rendering of the span? Well, from the aria point of view, that change would be correct. The button has already all info for aria, the closeIcon is for visibility only that is why thre is aria-hidden. It is also possible to keep the line 102 as it was. Then using antd overwrite of closeIcon is a must, to set aria-hidden as long as antd doesn't set aria-hidden on the span automatically. |
||
</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