Skip to content

Commit 9e3f1d4

Browse files
fix(data-grid-cell): add button role announcement for screen readers (VIV-2606) (#2325)
* fix(data-grid-cell): add button role announcement for screen readers (VIV-2606) * Update metadata --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 6621049 commit 9e3f1d4

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

libs/components/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1904,7 +1904,7 @@
19041904
},
19051905
{
19061906
"name": "gridTemplateColumns",
1907-
"description": "String that gets applied to the the css gridTemplateColumns attribute of child rows",
1907+
"description": "String that gets applied to the css gridTemplateColumns attribute of child rows",
19081908
"type": "string",
19091909
"attributeName": "grid-template-columns",
19101910
"propertyName": "gridTemplateColumns"

libs/components/src/lib/data-grid/data-grid-cell.spec.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,14 @@ describe('vwc-data-grid-cell', () => {
303303
element.ariaSort = 'none';
304304
});
305305

306+
it('should have a button role when sorting is enabled', async function () {
307+
element.setAttribute('aria-sort', 'none');
308+
await elementUpdated(element);
309+
const baseElement = element.shadowRoot?.querySelector('.base');
310+
311+
expect(baseElement?.role).toEqual('button');
312+
});
313+
306314
it('should show sort-solid icon in the header when "none" is set', async function () {
307315
element.setAttribute('aria-sort', 'none');
308316
await elementUpdated(element);

libs/components/src/lib/data-grid/data-grid-cell.template.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ export const DataGridCellTemplate = (
5858
@click="${(x) => x._handleInteraction()}"
5959
@keydown="${(x, c) => handleKeyDown(x, c.event as KeyboardEvent)}"
6060
>
61-
<div class="base">
61+
<div
62+
class="base"
63+
role="${(x) => (shouldShowSortIcons(x) ? 'button' : undefined)}"
64+
>
6265
<slot></slot>
6366
${(_) => renderSortIcons(context)}
6467
</div>

libs/components/src/lib/data-grid/data-grid.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ export class DataGrid extends VividElement {
179179
}
180180

181181
/**
182-
* String that gets applied to the the css gridTemplateColumns attribute of child rows
182+
* String that gets applied to the css gridTemplateColumns attribute of child rows
183183
*
184184
* @public
185185
* @remarks

0 commit comments

Comments
 (0)