Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fix(autocomplete): list the notes above the note picker's modal
Claude90ce95a1aa86
diff --git a/apps/client/src/widgets/react/NoteAutocomplete.spec.tsx b/apps/client/src/widgets/react/NoteAutocomplete.spec.tsxindex b10a3deaf9..0b880eae62 100644--- a/apps/client/src/widgets/react/NoteAutocomplete.spec.tsx+++ b/apps/client/src/widgets/react/NoteAutocomplete.spec.tsx@@ -863,6 +863,20 @@ describe("NoteAutocomplete's suggestion list", () => {expect(document.querySelector<HTMLElement>(".note-autocomplete-menu")?.style.width).toBe("680px");});+ it("lists inside the modal around the field, above the modal's own layer", async () => {+ let modal: HTMLElement | null = null;+ await act(async () => {+ modal = renderInto(<div className="modal"><NoteAutocomplete /></div>).querySelector(".modal");+ });+ const input = (modal as HTMLElement | null)?.querySelector("input");+ if (!modal || !input) throw new Error("no input rendered");+ await type(input, "a");++ const menu = document.querySelector(".note-autocomplete-menu");+ expect(menu).not.toBe(null);+ expect(menu?.closest(".modal")).toBe(modal);+ });+it("widens past a narrow field, and spans a wide one", async () => {const input = await mount();const group = input.closest(".input-group");diff --git a/apps/client/src/widgets/react/NoteAutocomplete.tsx b/apps/client/src/widgets/react/NoteAutocomplete.tsxindex c5d7a67103..2e522f3c08 100644--- a/apps/client/src/widgets/react/NoteAutocomplete.tsx+++ b/apps/client/src/widgets/react/NoteAutocomplete.tsx@@ -325,6 +325,9 @@ export default function NoteAutocomplete({ id, inputRef: externalInputRef, text,: anchor && (<Popupanchor={anchor}+ // Rendered in the field's modal so the list stacks above it: the note picker+ // raises its modal (2000) over `.tn-popup` in the body (1200).+ container={anchor.closest<HTMLElement>(".modal") ?? undefined}placement="bottom-start"// The pointer moves the highlighted row, so `:hover` marks no second one.className="dropdown-menu show tn-dropdown-menu tn-menu-keyboard note-autocomplete-menu"