Skip to content
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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

DmitriBountsman
Copy link

Allow change close aria-label fixing accessibility issues for other language than englisch

Copy link

vercel bot commented Jan 3, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
dialog ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 8, 2024 8:43am

<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>
Copy link
Member

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.

Copy link
Author

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?

@@ -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`}>
Copy link
Member

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

Copy link
Author

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?

Copy link
Member

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yoyo837
Copy link
Member

yoyo837 commented Jan 5, 2024

Please add some test case to cover it.

@yoyo837
Copy link
Member

yoyo837 commented Feb 2, 2024

Conflicted.

Copy link

codecov bot commented Feb 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (8ded2a8) 99.41% compared to head (12a6e37) 99.43%.
Report is 4 commits behind head on master.

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.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants