Fixing shadow behavior when scrolling table component. (#52795)

* Fixing shadow behavior when scrolling table component.
This commit is contained in:
Joel Thiessen 2024-11-14 08:23:58 -08:00 committed by GitHub
parent 3e91243b70
commit 7a4638151d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 4 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Fixing box shadow behavior on WooCommerce table component when scrolling.

View File

@ -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 ) {