From b91bab09b295148b3ded850e630d3562c533c2e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?kiner-tang=28=E6=96=87=E8=BE=89=29?= <1127031143@qq.com> Date: Thu, 22 Dec 2022 20:47:46 +0800 Subject: [PATCH] fix(table): reset aria-label in table column (#39738) * feat: reset aria-label in table column * feat: reset aria-label in table column --- .../__snapshots__/components.test.tsx.snap | 14 +++++----- .../table/__tests__/Table.sorter.test.tsx | 4 +-- .../__snapshots__/Table.sorter.test.tsx.snap | 2 +- .../__snapshots__/Table.test.tsx.snap | 10 +++---- .../__snapshots__/demo-extend.test.ts.snap | 28 +++++++++---------- .../__tests__/__snapshots__/demo.test.ts.snap | 28 +++++++++---------- components/table/hooks/useSorter.tsx | 4 +-- 7 files changed, 43 insertions(+), 47 deletions(-) diff --git a/components/config-provider/__tests__/__snapshots__/components.test.tsx.snap b/components/config-provider/__tests__/__snapshots__/components.test.tsx.snap index 216a1eabe2ba..6c9daf135036 100644 --- a/components/config-provider/__tests__/__snapshots__/components.test.tsx.snap +++ b/components/config-provider/__tests__/__snapshots__/components.test.tsx.snap @@ -26610,7 +26610,7 @@ exports[`ConfigProvider components Table configProvider 1`] = ` > { fireEvent.click(container.querySelector('.ant-table-column-sorters')!); expect(getNameColumn()?.getAttribute('aria-sort')).toEqual(null); - expect(getNameColumn()?.getAttribute('aria-label')).toEqual( - "this column's title is Name,this column is sortable", - ); + expect(getNameColumn()?.getAttribute('aria-label')).toEqual('Name'); }); it('sort records', () => { diff --git a/components/table/__tests__/__snapshots__/Table.sorter.test.tsx.snap b/components/table/__tests__/__snapshots__/Table.sorter.test.tsx.snap index ed08b4d683a5..ec12a8d68f04 100644 --- a/components/table/__tests__/__snapshots__/Table.sorter.test.tsx.snap +++ b/components/table/__tests__/__snapshots__/Table.sorter.test.tsx.snap @@ -6,7 +6,7 @@ exports[`Table.sorter renders sorter icon correctly 1`] = ` > ( if (sorterOrder) { cell['aria-sort'] = sorterOrder === 'ascend' ? 'ascending' : 'descending'; } else { - cell['aria-label'] = `${ - displayTitle ? `this column's title is ${displayTitle},` : '' - }this column is sortable`; + cell['aria-label'] = displayTitle || ''; } cell.className = classNames(cell.className, `${prefixCls}-column-has-sorters`); cell.tabIndex = 0;