Skip to content

Commit f0c5dda

Browse files
authored
Fix "overflowMode: wrap" TableViews so that the selection checkbox cells have the proper z-index (#2179)
1 parent c883aa3 commit f0c5dda

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed

packages/@react-spectrum/table/test/Table.test.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3638,6 +3638,22 @@ describe('TableView', function () {
36383638
act(() => jest.runAllTimers());
36393639
expect(tree.queryByRole('checkbox')).toBeNull();
36403640
});
3641+
3642+
it('should return the proper cell z-indexes for overflowMode="wrap"', function () {
3643+
let tree = renderTable({overflowMode: 'wrap', selectionMode: 'multiple'});
3644+
let rows = tree.getAllByRole('row');
3645+
expect(rows).toHaveLength(3);
3646+
3647+
for (let row of rows) {
3648+
for (let [index, cell] of row.childNodes.entries()) {
3649+
if (index === 0) {
3650+
expect(cell.style.zIndex).toBe('2');
3651+
} else {
3652+
expect(cell.style.zIndex).toBe('1');
3653+
}
3654+
}
3655+
}
3656+
});
36413657
});
36423658

36433659
describe('column widths', function () {

packages/@react-stately/virtualizer/src/LayoutInfo.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ export class LayoutInfo {
9494
res.transform = this.transform;
9595
res.parentKey = this.parentKey;
9696
res.isSticky = this.isSticky;
97+
res.zIndex = this.zIndex;
9798
return res;
9899
}
99100
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Copyright 2021 Adobe. All rights reserved.
3+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License. You may obtain a copy
5+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
6+
*
7+
* Unless required by applicable law or agreed to in writing, software distributed under
8+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9+
* OF ANY KIND, either express or implied. See the License for the specific language
10+
* governing permissions and limitations under the License.
11+
*/
12+
13+
import {LayoutInfo, Rect} from '../';
14+
15+
describe('LayoutInfo', () => {
16+
it('should return a copy of the current LayoutInfo after calling copy()', () => {
17+
let layoutInfo = new LayoutInfo('loader', 'key', new Rect(10, 10, 10, 10));
18+
layoutInfo.parentKey = 'parent key';
19+
layoutInfo.estimatedSize = true;
20+
layoutInfo.isSticky = true;
21+
layoutInfo.opacity = 3;
22+
layoutInfo.transform = 'scale3d(0.8, 0.8, 0.8)';
23+
layoutInfo.zIndex = 5;
24+
// Cursory check that layoutInfo has been changed
25+
expect(layoutInfo.zIndex).toBe(5);
26+
27+
let copy = layoutInfo.copy();
28+
expect(copy).toEqual(layoutInfo);
29+
30+
});
31+
});

0 commit comments

Comments
 (0)