diff --git a/packages/js/components/changelog/52795-fix-woo-table-scroll-shadow b/packages/js/components/changelog/52795-fix-woo-table-scroll-shadow new file mode 100644 index 00000000000..e0ea7454f86 --- /dev/null +++ b/packages/js/components/changelog/52795-fix-woo-table-scroll-shadow @@ -0,0 +1,4 @@ +Significance: patch +Type: fix + +Fixing box shadow behavior on WooCommerce table component when scrolling. \ No newline at end of file diff --git a/packages/js/components/src/table/table.tsx b/packages/js/components/src/table/table.tsx index 281fd695964..c316b49fcdd 100644 --- a/packages/js/components/src/table/table.tsx +++ b/packages/js/components/src/table/table.tsx @@ -137,16 +137,14 @@ const Table: React.VFC< TableProps > = ( { if ( table?.scrollWidth && table?.scrollHeight && table?.offsetWidth ) { const scrolledToEnd = - table?.scrollWidth - table?.scrollLeft <= table?.offsetWidth; + table.scrollWidth - table.scrollLeft <= table.offsetWidth; if ( scrolledToEnd && isScrollableRight ) { setIsScrollableRight( false ); } else if ( ! scrolledToEnd && ! isScrollableRight ) { setIsScrollableRight( true ); } - } - if ( table?.scrollLeft ) { - const scrolledToStart = table?.scrollLeft <= 0; + const scrolledToStart = table.scrollLeft === 0; if ( scrolledToStart && isScrollableLeft ) { setIsScrollableLeft( false ); } else if ( ! scrolledToStart && ! isScrollableLeft ) {