diff --git a/e2e-tests/provenance.spec.ts b/e2e-tests/provenance.spec.ts index 2804675f..c825a877 100644 --- a/e2e-tests/provenance.spec.ts +++ b/e2e-tests/provenance.spec.ts @@ -24,9 +24,9 @@ test('Selection History', async ({ page }) => { // Testing history for an aggregate row selection & deselection await page.getByRole('radio', { name: 'Degree' }).check(); - await page.locator('g').filter({ hasText: /^Degree 3Degree 3$/ }).locator('rect').click(); + await page.locator('g').filter({ hasText: /^Degree 3Degree 3$/ }).locator('rect').nth(0).click(); await expect(page.locator('div').filter({ hasText: /^Select intersection "Degree 3"$/ }).nth(2)).toBeVisible(); - await page.locator('g').filter({ hasText: /^Degree 3Degree 3$/ }).locator('rect').click(); + await page.locator('g').filter({ hasText: /^Degree 3Degree 3$/ }).locator('rect').nth(0).click(); await expect(page.getByText('Deselect intersection').nth(1)).toBeVisible(); // Check that selections are maintained after de-aggregation diff --git a/packages/upset/src/components/Rows/AggregateRow.tsx b/packages/upset/src/components/Rows/AggregateRow.tsx index 2f32c71d..70830599 100644 --- a/packages/upset/src/components/Rows/AggregateRow.tsx +++ b/packages/upset/src/components/Rows/AggregateRow.tsx @@ -7,7 +7,10 @@ import SvgIcon from '@mui/material/SvgIcon'; import { visibleSetSelector } from '../../atoms/config/visibleSetsAtoms'; import { dimensionsSelector } from '../../atoms/dimensionsAtom'; -import { currentIntersectionSelector } from '../../atoms/config/currentIntersectionAtom'; +import { + bookmarkSelector, + currentIntersectionSelector, +} from '../../atoms/config/currentIntersectionAtom'; import translate from '../../utils/transform'; import { highlight, mousePointer } from '../../utils/styles'; import { SizeBar } from '../Columns/SizeBar'; @@ -43,7 +46,15 @@ const expanded = ( * Collapsed icon for the AggregateRow component. */ export const collapsed = ( - + @@ -85,19 +96,28 @@ export const AggregateRow: FC = ({ aggregateRow }) => { return ( aggregateRow && - (currentIntersection?.id === aggregateRow.id ? - actions.setSelected(null) : actions.setSelected(aggregateRow))} + onClick={() => + aggregateRow && + (currentIntersection?.id === aggregateRow.id + ? actions.setSelected(null) + : actions.setSelected(aggregateRow)) + } css={mousePointer} > - + = ({ aggregateRow }) => { stroke="#555555" strokeWidth="1px" /> - { - if (collapsedIds.includes(aggregateRow.id)) { - actions.removeCollapsed(aggregateRow.id); - } else { - actions.addCollapsed(aggregateRow.id); - } - // To prevent the handler on SvgBase that deselects the current intersection - e.stopPropagation(); - }} - > - { collapsedIds.includes(aggregateRow.id) ? collapsed : expanded} + + {collapsedIds.includes(aggregateRow.id) ? collapsed : expanded} + {/* onclick background element */} + { + e.stopPropagation(); + if (collapsedIds.includes(aggregateRow.id)) { + actions.removeCollapsed(aggregateRow.id); + } else { + actions.addCollapsed(aggregateRow.id); + } + }} + /> = ({ aggregateRow }) => { /> )} - + - + );