fix issue of invalid aria-label values

This commit is contained in:
btzr-io 2021-07-13 15:19:52 -05:00
parent e9710150ad
commit 6eca14f140
2 changed files with 7 additions and 1 deletions

View file

@ -2040,5 +2040,8 @@
"Tip Creators": "Tip Creators",
"Only select creators can receive tips at this time": "Only select creators can receive tips at this time",
"The payment will be made from your saved card": "The payment will be made from your saved card",
"Trending for #Art": "Trending for #Art",
"Trending for #Education": "Trending for #Education",
"Trending for #Technology": "Trending for #Technology",
"--end--": "--end--"
}

View file

@ -97,6 +97,9 @@ const Button = forwardRef<any, {}>((props: Props, ref: any) => {
const combinedRef = useCombinedRefs(ref, innerRef, myref);
const size = iconSize || (!label && !children) ? 18 : undefined; // Fall back to default
// Label can be a string or object ( use title instead )
const ariaLabel = description || (typeof label === 'string' ? label : title);
const content = (
<span className="button__content">
{icon && <Icon icon={icon} iconColor={iconColor} size={iconSize} />}
@ -224,7 +227,7 @@ const Button = forwardRef<any, {}>((props: Props, ref: any) => {
<button
ref={combinedRef}
title={title || defaultTooltip}
aria-label={description || label || title}
aria-label={ariaLabel}
className={combinedClassName}
onClick={(e) => {
if (onClick) {