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
add style.label to aria-label #2169
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #2169 +/- ##
==========================================
+ Coverage 51.49% 51.58% +0.08%
==========================================
Files 101 101
Lines 1967 1983 +16
Branches 572 582 +10
==========================================
+ Hits 1013 1023 +10
- Misses 856 862 +6
Partials 98 98
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
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.
Nice work! 🔥 🥇
labelText: ({ content, label, period }) => { | ||
let text = `${FUNDING_BRAND_LABEL.PAYPAL}`; | ||
if (content && label === BUTTON_LABEL.INSTALLMENT) { | ||
if (period) { | ||
text = content["label.installment.withPeriod"].replace( | ||
"{period}", | ||
String(period) | ||
); | ||
} else { | ||
text = content["label.installment.withoutPeriod"]; | ||
} | ||
} else if (content && label) { | ||
text = content[`label.${label}`]; | ||
} | ||
return text; | ||
}, |
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.
we should consider unit testing this
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.
good call - let me see if that could be a quick win!
This PR is a follow up to paypal#2169 (29a18ec) that introduced an issue related to the correct content not being available.
Description
This PR adds localized text to the
aria-label
for the PayPal button whenstyle.label
is set.Why are we making these changes? Include references to any related Jira tasks or GitHub Issues
Improve accessibility with more accurate
aria-label
values. Previously, the name of the funding source was used, which ended up being "PayPal" even in cases where a label was set.Screenshots (if applicable)
❤️ Thank you!