Skip to content

Commit

Permalink
fix: fixed tabindex for disabled variant
Browse files Browse the repository at this point in the history
  • Loading branch information
PKulkoRaccoonGang committed Oct 30, 2023
1 parent b50147b commit 0fe30c0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Chip/ChipIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ export interface ChipIconProps {
onClick?: KeyboardEventHandler & MouseEventHandler,
alt?: string,
variant: string,
disabled?: boolean,
}

function ChipIcon({
className, src, onClick, alt, variant,
className, src, onClick, alt, variant, disabled,
}: ChipIconProps) {
if (onClick) {
return (
Expand All @@ -26,6 +27,7 @@ function ChipIcon({
iconAs={Icon}
alt={alt}
invertColors={variant === STYLE_VARIANTS.DARK}
tabIndex={disabled ? -1 : 0}
/>
);
}
Expand All @@ -39,11 +41,13 @@ ChipIcon.propTypes = {
onClick: PropTypes.func,
alt: PropTypes.string.isRequired,
variant: PropTypes.string,
disabled: PropTypes.bool,
};

ChipIcon.defaultProps = {
onClick: undefined,
variant: STYLE_VARIANTS.LIGHT,
disabled: false,
};

export default ChipIcon;
1 change: 1 addition & 0 deletions src/Chip/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

[dir="rtl"] & {
margin-right: 0;
margin-left: .25rem;
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/Chip/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ const Chip = React.forwardRef(({
onClick={onIconBeforeClick}
alt={iconBeforeAlt}
variant={variant}
disabled={disabled}
/>
)}
<div
Expand All @@ -86,6 +87,7 @@ const Chip = React.forwardRef(({
onClick={onIconAfterClick}
alt={iconAfterAlt}
variant={variant}
disabled={disabled}
/>
)}
</div>
Expand Down

0 comments on commit 0fe30c0

Please sign in to comment.