Skip to content

Commit

Permalink
fix(react-grid): prevent scrolling sticky header on Safari (#2178)
Browse files Browse the repository at this point in the history
  • Loading branch information
MaximKudriavtsev committed Jul 23, 2019
1 parent 88baf47 commit 47666b7
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ export const TableContainer = ({
}}
{...restProps}
>
{children}
<div>
{children}
</div>
</div>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('TableContainer', () => {
</TableContainer>
));

expect(tree.find('div').prop('style'))
expect(tree.find('div').at(0).prop('style'))
.toMatchObject({
color: 'red',
});
Expand All @@ -39,4 +39,16 @@ describe('TableContainer', () => {
expect(tree.props().data)
.toMatchObject({ a: 1 });
});

it('should render a `div` block as a workaround Safari sticky bug', () => {
// https://bugs.webkit.org/show_bug.cgi?id=175029
const tree = shallow((
<TableContainer>
<div className="child" />
</TableContainer>
));

expect(tree.find('div').length)
.toBe(3);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ export const TableContainer = ({
}}
{...restProps}
>
{children}
<div>
{children}
</div>
</div>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,21 @@ describe('TableContainer', () => {
</TableContainer>
));

expect(tree.find('div').prop('style'))
expect(tree.find('div').at(0).prop('style'))
.toMatchObject({
msOverflowStyle: 'auto',
});
});

it('should render a `div` block as a workaround Safari sticky bug', () => {
// https://bugs.webkit.org/show_bug.cgi?id=175029
const tree = shallow((
<TableContainer>
<div className="child" />
</TableContainer>
));

expect(tree.find('div').length)
.toBe(3);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ const TableContainerBase = ({
className={classNames(classes.root, className)}
{...restProps}
>
{children}
<div>
{children}
</div>
</div>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,16 @@ describe('TableContainer', () => {
expect(tree.props().data)
.toMatchObject({ a: 1 });
});

it('should render a `div` block as a workaround Safari sticky bug', () => {
// https://bugs.webkit.org/show_bug.cgi?id=175029
const tree = shallow((
<TableContainer>
<div className="child" />
</TableContainer>
));

expect(tree.find('div').length)
.toBe(3);
});
});

0 comments on commit 47666b7

Please sign in to comment.