Skip to content

Commit

Permalink
refactor(report): [table] allow scroll only when ctrl or meta key is …
Browse files Browse the repository at this point in the history
…pressed

Signed-off-by: Danil Kostromin <[email protected]>
  • Loading branch information
okt-limonikas committed Nov 28, 2024
1 parent 6858047 commit 26f9495
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
} from '@radix-ui/react-hover-card';

import { ArgsValBlock, RecordBlock } from '@/shared/types';
import { usePlatformSpecificCtrl } from '@/shared/hooks';
import {
CardHeader,
Icon,
Expand Down Expand Up @@ -181,6 +182,9 @@ function MeasurementBlock(props: RunReportEntityBlockProps) {
?.removeEventListener('scroll', handleScroll);
}, [offset]);

const tableScrollRef = useRef<HTMLDivElement>(null);
const isPressed = usePlatformSpecificCtrl();

return (
<div className="flex flex-col pl-1">
<div className="flex flex-col max-h-[412px]" id={encodeURIComponent(id)}>
Expand Down Expand Up @@ -229,7 +233,13 @@ function MeasurementBlock(props: RunReportEntityBlockProps) {
enableChartView && chart && 'border-l border-border-primary'
)}
>
<div className="flex-1 overflow-auto">
<div
className={cn(
'flex-1',
isPressed ? 'overflow-y-auto' : 'overflow-y-hidden'
)}
ref={tableScrollRef}
>
<RunReportTable table={table} />
</div>
</div>
Expand Down

0 comments on commit 26f9495

Please sign in to comment.