Fixing shadow behavior when scrolling table component. (#52795)
* Fixing shadow behavior when scrolling table component.
This commit is contained in:
parent
3e91243b70
commit
7a4638151d
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: fix
|
||||||
|
|
||||||
|
Fixing box shadow behavior on WooCommerce table component when scrolling.
|
|
@ -137,16 +137,14 @@ const Table: React.VFC< TableProps > = ( {
|
||||||
|
|
||||||
if ( table?.scrollWidth && table?.scrollHeight && table?.offsetWidth ) {
|
if ( table?.scrollWidth && table?.scrollHeight && table?.offsetWidth ) {
|
||||||
const scrolledToEnd =
|
const scrolledToEnd =
|
||||||
table?.scrollWidth - table?.scrollLeft <= table?.offsetWidth;
|
table.scrollWidth - table.scrollLeft <= table.offsetWidth;
|
||||||
if ( scrolledToEnd && isScrollableRight ) {
|
if ( scrolledToEnd && isScrollableRight ) {
|
||||||
setIsScrollableRight( false );
|
setIsScrollableRight( false );
|
||||||
} else if ( ! scrolledToEnd && ! isScrollableRight ) {
|
} else if ( ! scrolledToEnd && ! isScrollableRight ) {
|
||||||
setIsScrollableRight( true );
|
setIsScrollableRight( true );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ( table?.scrollLeft ) {
|
const scrolledToStart = table.scrollLeft === 0;
|
||||||
const scrolledToStart = table?.scrollLeft <= 0;
|
|
||||||
if ( scrolledToStart && isScrollableLeft ) {
|
if ( scrolledToStart && isScrollableLeft ) {
|
||||||
setIsScrollableLeft( false );
|
setIsScrollableLeft( false );
|
||||||
} else if ( ! scrolledToStart && ! isScrollableLeft ) {
|
} else if ( ! scrolledToStart && ! isScrollableLeft ) {
|
||||||
|
|
Loading…
Reference in New Issue