Skip to content

Commit 7752e64

Browse files
authored
fix(design-system): add aria role to DsLoader [AR-54966] (#309)
1 parent 576e2f9 commit 7752e64

3 files changed

Lines changed: 10 additions & 9 deletions

File tree

.changeset/stale-doors-admire.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@drivenets/design-system': patch
3+
---
4+
5+
Add aria role to `DsLoader`

packages/design-system/src/components/ds-loader/ds-loader.stories.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,9 @@ type Story = StoryObj<typeof DsLoader>;
2424
* Default loader - rotating spinner arc
2525
*/
2626
export const Default: Story = {
27-
args: {
28-
'data-testid': 'loader',
29-
} as React.ComponentProps<typeof DsLoader>,
3027
play: async ({ canvasElement }) => {
3128
const canvas = within(canvasElement);
32-
const loader = canvas.getByTestId('loader');
29+
const loader = canvas.getByRole('progressbar');
3330

3431
await expect(loader).toBeInTheDocument();
3532
},
@@ -119,16 +116,15 @@ export const UsageExamples: Story = {
119116
};
120117

121118
/**
122-
* Test that custom props (className, style, data-testid) are forwarded to the container
119+
* Test that custom props (className, style) are forwarded to the container
123120
*/
124121
export const CustomProps: Story = {
125122
args: {
126123
className: styles.customPropsLoader,
127-
'data-testid': 'loader-test-id',
128-
} as React.ComponentProps<typeof DsLoader>,
124+
},
129125
play: async ({ canvasElement }) => {
130126
const canvas = within(canvasElement);
131-
const loader = canvas.getByTestId('loader-test-id');
127+
const loader = canvas.getByRole('progressbar');
132128

133129
await expect(loader).toBeInTheDocument();
134130
await expect(loader.className).toContain('customPropsLoader');

packages/design-system/src/components/ds-loader/ds-loader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import SpinnerIcon from './spinner-icon';
99
*/
1010
const DsLoader = ({ variant = 'spinner', className, ...props }: DsLoaderProps) => {
1111
return (
12-
<div className={classNames(styles.loaderContainer, className)} {...props}>
12+
<div className={classNames(styles.loaderContainer, className)} role="progressbar" {...props}>
1313
{variant === 'pulsing' ? <PulsingIcon /> : <SpinnerIcon />}
1414
</div>
1515
);

0 commit comments

Comments
 (0)