From 99978cfe7024d7fff7f20540fd41b3a4dc6d5624 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Tue, 17 Nov 2026 20:17:51 -0500 Subject: [PATCH] Anchor the filter menu to the filter button --- app/editor/components/TableFilterMenu.tsx | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) 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() {