Skip to content

Commit

Permalink
test(dataspreadsheet): add default avt (#5320)
Browse files Browse the repository at this point in the history
Co-authored-by: Matt Gallo <[email protected]>
  • Loading branch information
szinta and matthewgallo authored May 23, 2024
1 parent c364283 commit df5f740
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
26 changes: 26 additions & 0 deletions e2e/components/DataSpreadsheet/DataSpreadsheet-test.avt.e2e.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* Copyright IBM Corp. 2024, 2024
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

'use strict';

import { expect, test } from '@playwright/test';
import { visitStory } from '../../test-utils/storybook';

test.describe('DataSpreadsheet @avt', () => {
test('@avt-default-state', async ({ page }) => {
await visitStory(page, {
component: 'DataSpreadsheet',
id: 'ibm-products-components-data-spreadsheet-dataspreadsheet--data-spreadsheet',
globals: {
carbonTheme: 'white',
},
});
await expect(page).toHaveNoACViolations(
'DataSpreadsheet @avt-default-state'
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,12 @@ export const DataSpreadsheetHeader = forwardRef(
scrollContainer?.clientHeight &&
scrollContainer?.scrollHeight > scrollContainer?.clientHeight;
const scrollBarValue = hasScrollBar ? 0 : scrollBarSize;

// fix for a11y violation element_scrollable_tabbable
if (!scrollContainer?.getAttribute('tabIndex')) {
scrollContainer?.setAttribute('tabIndex', '0');
}

setScrollBarSizeValue(scrollBarValue);
}
}, [cellSize, ref, scrollBarSize, previousState?.cellSize]);
Expand Down

0 comments on commit df5f740

Please sign in to comment.