Anchor the filter menu to the filter button

This commit is contained in:
Tom Moor committed 2026-11-17 20:17:51 -05:00
1 parent 5bfbf35a63
commit 99978cfe70
1 file changed
+17 -2
+17 -2
View File
@@ -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() {
<PopoverContent
width={300}
style={MenuStyle}
align="start"
align="end"
aria-label={
columnName
? t("Filter {{ columnName }}", { columnName })