Skip to content

Commit

Permalink
default is hidden on icon (#176)
Browse files Browse the repository at this point in the history
* bump ver

* bump ver
  • Loading branch information
Hadas Farhi authored Jul 25, 2021
1 parent 0dbdc6b commit 5efd77d
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 7 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "monday-ui-react-core",
"version": "0.3.63",
"version": "0.3.64",
"description": "Official monday.com UI resources for application development in React.js",
"main": "dist/main.js",
"scripts": {
Expand Down Expand Up @@ -167,4 +167,4 @@
"not and_qq > 0",
"not and_uc > 0"
]
}
}
11 changes: 10 additions & 1 deletion src/components/Avatar/AvatarContent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,16 @@ export const AvatarContent = ({ type, src, icon, text, ariaLabel, role, size })
case AVATAR_TYPES.IMG:
return <img role={role} alt={ariaLabel} src={src} className={className} />;
case AVATAR_TYPES.ICON:
return <Icon icon={icon} aria-label={ariaLabel} role={role} clickable={false} className={className} />;
return (
<Icon
icon={icon}
aria-label={ariaLabel}
role={role}
clickable={false}
className={className}
ariaHidden={false}
/>
);
case AVATAR_TYPES.TEXT:
return (
<span aria-label={ariaLabel} role={role} className={className}>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Icon/CustomSvgIcon.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ CustomSvgIcon.propTypes = {
className: "",
src: "",
ariaLabel: undefined,
ariaHidden: false
ariaHidden: undefined
};

export default CustomSvgIcon;
2 changes: 1 addition & 1 deletion src/components/Icon/Icon.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Icon.defaultProps = {
iconType: ICON_TYPES.SVG,
iconSize: 16,
ignoreFocusStyle: false,
ariaHidden: false
ariaHidden: undefined
};

export default Icon;
12 changes: 10 additions & 2 deletions src/helpers/screenReaderAccessHelper.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
import isNil from "lodash/isNil";

export function getIconScreenReaderAccessProps({ isClickable, isDecorationOnly, isKeyboardAccessible, label }) {
if (isClickable) return getClickableIconScreenReaderAccessProps({ label, isDecorationOnly, isKeyboardAccessible });
const overrideIsDecorationOnly = isNil(isDecorationOnly) ? !isClickable : isDecorationOnly;
if (isClickable)
return getClickableIconScreenReaderAccessProps({
label,
isDecorationOnly: overrideIsDecorationOnly,
isKeyboardAccessible
});
return {
role: "img",
"aria-hidden": isDecorationOnly,
"aria-hidden": overrideIsDecorationOnly,
tabIndex: undefined,
"aria-label": isDecorationOnly ? undefined : label
};
Expand Down

0 comments on commit 5efd77d

Please sign in to comment.