File tree Expand file tree Collapse file tree 4 files changed +18
-4
lines changed Expand file tree Collapse file tree 4 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -356,6 +356,12 @@ function Table<RecordType extends DefaultRecordType>(props: TableProps<RecordTyp
356
356
357
357
if ( fixColumn ) {
358
358
scrollXStyle = { overflowX : 'scroll' } ;
359
+ // When no vertical scrollbar, should hide it
360
+ // https://github.com/ant-design/ant-design/pull/20705
361
+ // https://github.com/ant-design/ant-design/issues/21879
362
+ if ( ! fixHeader ) {
363
+ scrollYStyle = { overflowY : 'hidden' } ;
364
+ }
359
365
scrollTableStyle = {
360
366
width : scroll . x === true ? 'auto' : scroll . x ,
361
367
minWidth : '100%' ,
Original file line number Diff line number Diff line change @@ -15,6 +15,8 @@ describe('Table.Scroll', () => {
15
15
it ( 'renders scroll.x is true' , ( ) => {
16
16
const wrapper = mount ( createTable ( { scroll : { x : true } } ) ) ;
17
17
expect ( wrapper . find ( 'table' ) . props ( ) . style . width ) . toEqual ( 'auto' ) ;
18
+ expect ( wrapper . find ( '.rc-table-content' ) . props ( ) . style . overflowX ) . toEqual ( 'scroll' ) ;
19
+ expect ( wrapper . find ( '.rc-table-content' ) . props ( ) . style . overflowY ) . toEqual ( 'hidden' ) ;
18
20
} ) ;
19
21
20
22
it ( 'renders scroll.x is a number' , ( ) => {
@@ -27,6 +29,12 @@ describe('Table.Scroll', () => {
27
29
expect ( wrapper . find ( '.rc-table-body' ) . props ( ) . style . maxHeight ) . toEqual ( 200 ) ;
28
30
} ) ;
29
31
32
+ it ( 'renders scroll.x and scroll.y are both true' , ( ) => {
33
+ const wrapper = mount ( createTable ( { scroll : { x : true , y : 200 } } ) ) ;
34
+ expect ( wrapper . find ( '.rc-table-body' ) . props ( ) . style . overflowX ) . toEqual ( 'scroll' ) ;
35
+ expect ( wrapper . find ( '.rc-table-body' ) . props ( ) . style . overflowY ) . toEqual ( 'scroll' ) ;
36
+ } ) ;
37
+
30
38
it ( 'fire scroll event' , ( ) => {
31
39
jest . useFakeTimers ( ) ;
32
40
let scrollLeft = 0 ;
Original file line number Diff line number Diff line change @@ -113,7 +113,7 @@ exports[`Table.Expand renders fixed column correctly work 1`] = `
113
113
>
114
114
<div
115
115
class = " rc-table-content"
116
- style = " overflow-x: scroll;"
116
+ style = " overflow-x: scroll; overflow-y: hidden; "
117
117
>
118
118
<table
119
119
style = " width: 903px; min-width: 100%; table-layout: fixed;"
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ exports[`Table.FixedColumn renders correctly scrollX - with data 1`] = `
9
9
>
10
10
<div
11
11
class = " rc-table-content"
12
- style = " overflow-x: scroll;"
12
+ style = " overflow-x: scroll; overflow-y: hidden; "
13
13
>
14
14
<table
15
15
style = " width: 1200px; min-width: 100%; table-layout: fixed;"
@@ -629,7 +629,7 @@ exports[`Table.FixedColumn renders correctly scrollX - without data 1`] = `
629
629
>
630
630
<div
631
631
class = " rc-table-content"
632
- style = " overflow-x: scroll;"
632
+ style = " overflow-x: scroll; overflow-y: hidden; "
633
633
>
634
634
<table
635
635
style = " width: 1200px; min-width: 100%; table-layout: fixed;"
@@ -1448,7 +1448,7 @@ exports[`Table.FixedColumn renders correctly scrollXY - without data 1`] = `
1448
1448
>
1449
1449
<div
1450
1450
class = " rc-table-content"
1451
- style = " overflow-x: scroll;"
1451
+ style = " overflow-x: scroll; overflow-y: hidden; "
1452
1452
>
1453
1453
<table
1454
1454
style = " width: 1200px; min-width: 100%; table-layout: fixed;"
You can’t perform that action at this time.
0 commit comments