diff --git a/app/editor/components/TableFilterMenu.tsx b/app/editor/components/TableFilterMenu.tsx index 2eb24847c4..885181e651 100644 --- a/app/editor/components/TableFilterMenu.tsx +++ b/app/editor/components/TableFilterMenu.tsx @@ -129,7 +129,22 @@ export const TableFilterMenu = observer(function TableFilterMenu() { [view] ); - const anchorRef = React.useMemo(() => ({ current: cell }), [cell]); + // The menu hangs from the filter button, which ProseMirror can redraw while + // the menu is open, so the button is found again on each measure. + const anchorRef = React.useMemo( + () => ({ + current: cell + ? { + getBoundingClientRect: () => + ( + cell.querySelector(`.${EditorStyleHelper.tableFilterButton}`) ?? + cell + ).getBoundingClientRect(), + } + : null, + }), + [cell] + ); // The menu sits below the header cell, so the column name is only announced. const columnName = cell?.textContent?.trim(); @@ -145,7 +160,7 @@ export const TableFilterMenu = observer(function TableFilterMenu() {