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

chore(icon): Remove clickable prop and set icons as decorative by default #2181

Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/core/docs/vibe-3-changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@

- `dataTestId` -> `data-testid` [codemod]

### Icon
- `clickable, onClick, iconLabel` removed, should use iconButton in case of a clickable icon [codemod]
rivka-ungar marked this conversation as resolved.
Show resolved Hide resolved


### Label

- `wrapperClassName` -> `className` [codemod]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ exports[`Accordion renders correctly with allowMultiple 1`] = `
data-testid="icon"
fill="currentColor"
height="24"
onClick={[Function]}
viewBox="0 0 20 20"
width="24"
>
Expand Down Expand Up @@ -73,7 +72,6 @@ exports[`Accordion renders correctly with allowMultiple 1`] = `
data-testid="icon"
fill="currentColor"
height="24"
onClick={[Function]}
viewBox="0 0 20 20"
width="24"
>
Expand Down Expand Up @@ -112,7 +110,6 @@ exports[`Accordion renders correctly with allowMultiple 1`] = `
data-testid="icon"
fill="currentColor"
height="24"
onClick={[Function]}
viewBox="0 0 20 20"
width="24"
>
Expand Down Expand Up @@ -164,7 +161,6 @@ exports[`Accordion renders correctly with children 1`] = `
data-testid="icon"
fill="currentColor"
height="24"
onClick={[Function]}
viewBox="0 0 20 20"
width="24"
>
Expand Down Expand Up @@ -203,7 +199,6 @@ exports[`Accordion renders correctly with children 1`] = `
data-testid="icon"
fill="currentColor"
height="24"
onClick={[Function]}
viewBox="0 0 20 20"
width="24"
>
Expand Down Expand Up @@ -242,7 +237,6 @@ exports[`Accordion renders correctly with children 1`] = `
data-testid="icon"
fill="currentColor"
height="24"
onClick={[Function]}
viewBox="0 0 20 20"
width="24"
>
Expand Down Expand Up @@ -299,7 +293,6 @@ exports[`Accordion renders correctly with custom AccordionItem title 1`] = `
data-testid="icon"
fill="currentColor"
height="24"
onClick={[Function]}
viewBox="0 0 20 20"
width="24"
>
Expand Down Expand Up @@ -346,7 +339,6 @@ exports[`Accordion renders correctly with defaultIndex prop 1`] = `
data-testid="icon"
fill="currentColor"
height="24"
onClick={[Function]}
viewBox="0 0 20 20"
width="24"
>
Expand Down Expand Up @@ -390,7 +382,6 @@ exports[`Accordion renders correctly with defaultIndex prop 1`] = `
data-testid="icon"
fill="currentColor"
height="24"
onClick={[Function]}
viewBox="0 0 20 20"
width="24"
>
Expand Down Expand Up @@ -429,7 +420,6 @@ exports[`Accordion renders correctly with defaultIndex prop 1`] = `
data-testid="icon"
fill="currentColor"
height="24"
onClick={[Function]}
viewBox="0 0 20 20"
width="24"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ exports[`AccordionItem renders correctly with children 1`] = `
data-testid="icon"
fill="currentColor"
height="24"
onClick={[Function]}
viewBox="0 0 20 20"
width="24"
>
Expand Down Expand Up @@ -83,7 +82,6 @@ exports[`AccordionItem renders correctly with className 1`] = `
data-testid="icon"
fill="currentColor"
height="24"
onClick={[Function]}
viewBox="0 0 20 20"
width="24"
>
Expand Down Expand Up @@ -135,7 +133,6 @@ exports[`AccordionItem renders correctly with iconSize 1`] = `
data-testid="icon"
fill="currentColor"
height="36"
onClick={[Function]}
viewBox="0 0 20 20"
width="36"
>
Expand Down Expand Up @@ -187,7 +184,6 @@ exports[`AccordionItem renders correctly with id 1`] = `
data-testid="icon"
fill="currentColor"
height="24"
onClick={[Function]}
viewBox="0 0 20 20"
width="24"
>
Expand Down Expand Up @@ -245,7 +241,6 @@ exports[`AccordionItem renders correctly with title 1`] = `
data-testid="icon"
fill="currentColor"
height="24"
onClick={[Function]}
viewBox="0 0 20 20"
width="24"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ exports[`AlertBanner should render correctly with background color 1`] = `
data-testid="icon"
fill="currentColor"
height="20"
onClick={[Function]}
viewBox="0 0 20 20"
width="20"
>
Expand Down Expand Up @@ -131,7 +130,6 @@ exports[`AlertBanner should render correctly with props 1`] = `
data-testid="icon"
fill="currentColor"
height="20"
onClick={[Function]}
viewBox="0 0 20 20"
width="20"
>
Expand Down Expand Up @@ -188,7 +186,6 @@ exports[`AlertBanner should render correctly without props 1`] = `
data-testid="icon"
fill="currentColor"
height="20"
onClick={[Function]}
viewBox="0 0 20 20"
width="20"
>
Expand Down Expand Up @@ -328,7 +325,6 @@ exports[`AlertBanner should render with correctly with multiple elements 1`] = `
data-testid="icon"
fill="currentColor"
height="20"
onClick={[Function]}
viewBox="0 0 20 20"
width="20"
>
Expand Down Expand Up @@ -425,7 +421,6 @@ exports[`AlertBanner should render with correctly with text and button 1`] = `
data-testid="icon"
fill="currentColor"
height="20"
onClick={[Function]}
viewBox="0 0 20 20"
width="20"
>
Expand Down Expand Up @@ -526,7 +521,6 @@ exports[`AlertBanner should render with correctly with text and link 1`] = `
data-testid="icon"
fill="currentColor"
height="20"
onClick={[Function]}
viewBox="0 0 20 20"
width="20"
>
Expand Down
24 changes: 1 addition & 23 deletions packages/core/src/components/AttentionBox/AttentionBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,6 @@ const AttentionBox: React.FC<AttentionBoxProps> & {
"data-testid": dataTestId,
closeButtonAriaLabel = "Close"
}) => {
const iconLabel = useMemo(() => {
Copy link
Member

Choose a reason for hiding this comment

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

So this was redundant in terms of a11y?

if (type === AttentionBoxType.DANGER) {
return "alert";
}

if (type === AttentionBoxType.SUCCESS) {
return "success";
}

return "attention";
}, [type]);

const defaultIcon = useMemo(() => {
return type === AttentionBox.types.PRIMARY ? InfoIcon : AlertIcon;
}, [type]);
Expand All @@ -90,11 +78,9 @@ const AttentionBox: React.FC<AttentionBoxProps> & {
className={styles.icon}
iconType={iconType}
ariaHidden
clickable={false}
icon={overrideIcon}
ignoreFocusStyle
iconSize="20"
iconLabel={iconLabel}
/>
)}
<Text type={Text.types.TEXT1} element="h5" weight={Text.weights.MEDIUM} className={styles.title}>
Expand All @@ -104,15 +90,7 @@ const AttentionBox: React.FC<AttentionBoxProps> & {
)}
<Flex justify={Flex.justify.START} align={Flex.align.CENTER} gap={Flex.gaps.XS}>
{!title && compact && !withoutIcon && withIconWithoutHeader && (
<Icon
iconType={iconType}
iconSize={18}
ariaHidden
clickable={false}
icon={overrideIcon}
ignoreFocusStyle
iconLabel={iconLabel}
/>
<Icon iconType={iconType} iconSize={18} ariaHidden icon={overrideIcon} ignoreFocusStyle />
)}
<Text
type={Text.types.TEXT2}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ exports[`AttentionBox renders correctly renders correctly 1`] = `
data-testid="icon"
fill="currentColor"
height="20"
onClick={[Function]}
viewBox="0 0 20 20"
width="20"
>
Expand Down Expand Up @@ -76,7 +75,6 @@ exports[`AttentionBox renders correctly renders correctly className 1`] = `
data-testid="icon"
fill="currentColor"
height="20"
onClick={[Function]}
viewBox="0 0 20 20"
width="20"
>
Expand Down Expand Up @@ -132,7 +130,6 @@ exports[`AttentionBox renders correctly renders correctly dark type 1`] = `
data-testid="icon"
fill="currentColor"
height="20"
onClick={[Function]}
viewBox="0 0 20 20"
width="20"
>
Expand Down Expand Up @@ -188,7 +185,6 @@ exports[`AttentionBox renders correctly renders correctly when compact 1`] = `
data-testid="icon"
fill="currentColor"
height="20"
onClick={[Function]}
viewBox="0 0 20 20"
width="20"
>
Expand Down Expand Up @@ -330,7 +326,6 @@ exports[`AttentionBox renders correctly renders correctly with onClose 1`] = `
data-testid="icon"
fill="currentColor"
height="20"
onClick={[Function]}
viewBox="0 0 20 20"
width="20"
>
Expand Down Expand Up @@ -394,7 +389,6 @@ exports[`AttentionBox renders correctly renders correctly with onClose 1`] = `
data-testid="icon"
fill="currentColor"
height="20"
onClick={[Function]}
viewBox="0 0 20 20"
width="20"
>
Expand Down Expand Up @@ -457,7 +451,6 @@ exports[`AttentionBox renders correctly renders with icon font type 1`] = `
aria-hidden={true}
className="icon icon noFocusStyle fa fa fa-star"
data-testid="icon"
onClick={[Function]}
role="img"
/>
<h5
Expand Down
11 changes: 1 addition & 10 deletions packages/core/src/components/Avatar/AvatarBadge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,7 @@ export const AvatarBadge: React.FC<AvatarBadgeProps> & {
const testId = dataTestId || getTestId(ComponentDefaultTestId.AVATAR_BADGE, id);

if (icon) {
return (
<Icon
icon={icon}
iconLabel={ariaLabel}
className={classNames}
clickable={tabIndex === -1}
{...otherProps}
data-testid={testId}
/>
);
return <Icon icon={icon} className={classNames} {...otherProps} data-testid={testId} />;
}

return src ? (
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/components/Avatar/AvatarContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ export const AvatarContent: React.FC<AvatarContentProps> & {
icon={icon}
aria-label={ariaLabel}
// role={role}
clickable={false}
className={className}
ariaHidden={false}
id={id}
Expand Down
3 changes: 0 additions & 3 deletions packages/core/src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,6 @@ const Button: VibeComponent<ButtonProps, unknown> & {
{leftIcon ? (
<Icon
iconType={Icon?.type.ICON_FONT}
clickable={false}
icon={leftIcon}
iconSize={leftIconSize}
className={cx({
Expand All @@ -323,7 +322,6 @@ const Button: VibeComponent<ButtonProps, unknown> & {
{rightIcon ? (
<Icon
iconType={Icon?.type.ICON_FONT}
clickable={false}
icon={rightIcon}
iconSize={rightIconSize}
className={cx({
Expand Down Expand Up @@ -357,7 +355,6 @@ const Button: VibeComponent<ButtonProps, unknown> & {
{successIcon ? (
<Icon
iconType={Icon?.type.ICON_FONT}
clickable={false}
icon={successIcon}
iconSize={successIconSize}
className={cx({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,6 @@ exports[`Button renders correctly renders correctly with leftIcon 1`] = `
data-testid="icon"
fill="currentColor"
height="20"
onClick={[Function]}
viewBox="0 0 20 20"
width="20"
>
Expand Down Expand Up @@ -422,7 +421,6 @@ exports[`Button renders correctly renders correctly with rightIcon 1`] = `
data-testid="icon"
fill="currentColor"
height="20"
onClick={[Function]}
viewBox="0 0 20 20"
width="20"
>
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/components/Checkbox/Checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ const Checkbox: VibeComponent<CheckBoxProps, HTMLInputElement> = forwardRef(
iconType={Icon.type.SVG}
icon={indeterminate ? Remove : Check}
ignoreFocusStyle
clickable={false}
ariaHidden={true}
iconSize="16"
/>
Expand Down
Loading