-
-
Notifications
You must be signed in to change notification settings - Fork 187
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?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
src/Dialog/Content/Panel.tsx
Outdated
<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 comment
The reason will be displayed to describe this comment to others. Learn more.
The change to closeIcon
looks like a break change.
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.
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.
It would be already an improvement. Should I change the line in my PR?
src/Dialog/Content/Panel.tsx
Outdated
@@ -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`}> |
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 }
+ old closeIcon
.
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.
Please add some test case to cover it. |
Conflicted. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #385 +/- ##
==========================================
+ Coverage 99.41% 99.43% +0.02%
==========================================
Files 8 8
Lines 170 177 +7
Branches 52 55 +3
==========================================
+ Hits 169 176 +7
Misses 1 1 ☔ View full report in Codecov by Sentry. |
Allow change close aria-label fixing accessibility issues for other language than englisch