From 3be84e5083ccf7c60620d0fdbf3c0f166423f509 Mon Sep 17 00:00:00 2001 From: Liang Li Date: Tue, 27 Oct 2026 12:37:16 +0800 Subject: [PATCH 1/2] fix: keep controls in the measure row out of the tab order --- src/Body/MeasureRow.tsx | 10 +++++++++- tests/FixedHeader.spec.jsx | 17 +++++++++++++++++ tests/__snapshots__/ExpandRow.spec.jsx.snap | 10 +++++----- tests/__snapshots__/FixedColumn.spec.tsx.snap | 10 +++++----- tests/__snapshots__/Table.spec.jsx.snap | 2 +- 5 files changed, 37 insertions(+), 12 deletions(-) diff --git a/src/Body/MeasureRow.tsx b/src/Body/MeasureRow.tsx index 264116a2c..616595be4 100644 --- a/src/Body/MeasureRow.tsx +++ b/src/Body/MeasureRow.tsx @@ -23,8 +23,16 @@ const MeasureRow: React.FC = ({ const { measureRowRender } = useContext(TableContext, ['measureRowRender']); + // The row holds copies of the column titles, which may contain controls such as a + // select-all checkbox. aria-hidden alone leaves those focusable; visibility: hidden + // takes them out of the tab order while the row still lays out for measuring. const measureRow = ( - + { if (isVisible(ref.current)) { diff --git a/tests/FixedHeader.spec.jsx b/tests/FixedHeader.spec.jsx index 29add88f3..a140e7477 100644 --- a/tests/FixedHeader.spec.jsx +++ b/tests/FixedHeader.spec.jsx @@ -196,6 +196,23 @@ describe('Table.FixedHeader', () => { expect(container.querySelectorAll('th.rc-table-cell-fix-end')).toHaveLength(1); }); + it('should keep controls copied into the measure row out of the tab order', () => { + const { container } = render( + Select all, dataIndex: 'name', key: 'name' }, + ]} + data={[{ name: 'light', key: 1 }]} + scroll={{ y: 10 }} + />, + ); + + const measureRow = container.querySelector('.rc-table-measure-row'); + expect(measureRow.querySelector('button')).toBeTruthy(); + expect(measureRow.getAttribute('aria-hidden')).toBe('true'); + expect(measureRow.style.visibility).toBe('hidden'); + }); + it('should support measureRowRender to wrap MeasureRow with custom provider', async () => { const FilterDropdown = ({ visible, onVisibleChange }) => (
diff --git a/tests/__snapshots__/ExpandRow.spec.jsx.snap b/tests/__snapshots__/ExpandRow.spec.jsx.snap index e589629f2..68ac4d5f9 100644 --- a/tests/__snapshots__/ExpandRow.spec.jsx.snap +++ b/tests/__snapshots__/ExpandRow.spec.jsx.snap @@ -157,7 +157,7 @@ exports[`Table.Expand > does not crash if scroll is not set 1`] = `