Skip to content

Commit

Permalink
make skeletons non-focusable and add appropriate aria attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabricevladimir committed Apr 16, 2024
1 parent a75c529 commit 9250b5a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
13 changes: 11 additions & 2 deletions src/core/components/states/stateSkeletonBar/stateSkeletonBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { responsiveUtils } from '../../../utils';

export type SkeletonBarSize = 'sm' | 'md' | 'lg' | 'xl' | '2xl';

export interface IStateSkeletonBarProps extends ComponentPropsWithoutRef<'div'> {
export interface IStateSkeletonBarProps extends ComponentPropsWithoutRef<'span'> {
/**
* Responsive size attribute for the skeleton.
*/
Expand Down Expand Up @@ -34,7 +34,16 @@ export const StateSkeletonBar = forwardRef<HTMLDivElement, IStateSkeletonBarProp
className,
);

return <div data-testid="stateSkeletonBar" ref={ref} className={classes} {...otherProps} />;
return (
<span
data-testid="stateSkeletonBar"
ref={ref}
className={classes}
tabIndex={-1}
aria-hidden={true}
{...otherProps}
/>
);
});

StateSkeletonBar.displayName = 'StateSkeletonBar';
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { responsiveUtils } from '../../../utils';

export type SkeletonCircularSize = 'sm' | 'md' | 'lg' | 'xl' | '2xl';

export interface IStateSkeletonCircularProps extends ComponentPropsWithoutRef<'div'> {
export interface IStateSkeletonCircularProps extends ComponentPropsWithoutRef<'span'> {
/**
* Responsive size attribute for the skeleton.
*/
Expand Down Expand Up @@ -34,7 +34,16 @@ export const StateSkeletonCircular = forwardRef<HTMLDivElement, IStateSkeletonCi
className,
);

return <div data-testid="stateSkeletonCircular" ref={ref} className={classes} {...otherProps} />;
return (
<span
data-testid="stateSkeletonCircular"
ref={ref}
className={classes}
tabIndex={-1}
aria-hidden={true}
{...otherProps}
/>
);
});

StateSkeletonCircular.displayName = 'StateSkeletonCircular';

0 comments on commit 9250b5a

Please sign in to comment.