Skip to content

Build your personal knowledge base with Trilium Notes

fix(dropdown): suspend a dialog's focus trap before the menu takes focus

Claude99d901491cf5
diff --git a/apps/client/src/widgets/react/Dropdown.tsx b/apps/client/src/widgets/react/Dropdown.tsx
index ba7147e860..e9183ef029 100644
--- a/apps/client/src/widgets/react/Dropdown.tsx
+++ b/apps/client/src/widgets/react/Dropdown.tsx
@@ -238,7 +238,7 @@ function DropdownToggle({ id, className, buttonClassName, title, text, dropdownC
}, [ shown, mobileBackdrop ]);
// A dialog's focus trap would pull focus out of a popup that stands outside the dialog.
- useEffect(() => {
+ useLayoutEffect(() => {
if (!shown) return;
return suspendModalFocusTraps();
}, [ shown ]);
diff --git a/packages/trilium-e2e/src/support/app.ts b/packages/trilium-e2e/src/support/app.ts
index 519fb0b825..72ee9a8eef 100644
--- a/packages/trilium-e2e/src/support/app.ts
+++ b/packages/trilium-e2e/src/support/app.ts
@@ -201,7 +201,7 @@ export default class App {
const noteActionsButton = this.currentNoteSplit.locator(".note-actions");
await noteActionsButton.click();
- const dropdownMenu = noteActionsButton.locator(".dropdown-menu").first();
+ const dropdownMenu = this.page.locator(".tn-dropdown-portal.note-actions .dropdown-menu").first();
await this.page.waitForTimeout(100);
await expect(dropdownMenu).toBeVisible();
dropdownMenu.getByText(itemToFind).click();