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
feat(client): show a menu toggle's explanation as the row's tooltip
Elian Doran63611cac56a0
diff --git a/apps/client/src/widgets/react/FormList.tsx b/apps/client/src/widgets/react/FormList.tsxindex c1dd0d57a7..b795bb607f 100644--- a/apps/client/src/widgets/react/FormList.tsx+++ b/apps/client/src/widgets/react/FormList.tsx@@ -11,7 +11,6 @@ import { t } from "../../services/i18n";import { getActionSync } from "../../services/keyboard_actions";import { handleRightToLeftPlacement, isMobile, openInAppHelpFromUrl } from "../../services/utils";import FormToggle from "./FormToggle";-import HelpTooltipButton from "./HelpTooltipButton";import { useStaticTooltip, useSyncedRef, useUniqueName } from "./hooks";import Icon, { SvgIcon } from "./Icon";import { MasterDetailHeader } from "./master_detail";@@ -322,7 +321,7 @@ export function FormListToggleableItem({title: string;currentValue: boolean;helpPage?: string;- /** What the setting does, shown on hover. Unlike {@link helpPage}, it opens nothing. */+ /** What the setting does, shown beside the menu while the row is hovered. */helpTooltip?: string;onChange(newValue: boolean): void | Promise<void>;}) {@@ -331,6 +330,7 @@ export function FormListToggleableItem({return (<FormListItem{...props}+ title={helpTooltip}disabled={disabled}onClick={async (e) => {if ((e.target as HTMLElement | null)?.classList.contains("contextual-help")) {@@ -356,7 +356,6 @@ export function FormListToggleableItem({onClick={() => openInAppHelpFromUrl(helpPage)}/>)}- {helpTooltip && <HelpTooltipButton description={helpTooltip} />}<span class="switch-spacer" /></>}/>diff --git a/apps/client/src/widgets/react/NotePropertyMenu.spec.tsx b/apps/client/src/widgets/react/NotePropertyMenu.spec.tsxindex 8483f10c40..016f425f79 100644--- a/apps/client/src/widgets/react/NotePropertyMenu.spec.tsx+++ b/apps/client/src/widgets/react/NotePropertyMenu.spec.tsx@@ -59,7 +59,7 @@ describe("A collection property's explanation", () => {expect(element.querySelector(".help-tooltip-button")).toBeNull();});- it("stands on a checkbox too, whose label is the switch's own", async () => {+ it("is the tooltip of a checkbox's whole row, with no help icon", async () => {const element = await draw({type: "checkbox",label: "Inbox column",@@ -68,8 +68,11 @@ describe("A collection property's explanation", () => {bindToLabel: "board:showInbox"});- expect(element.textContent).toContain("Inbox column");- expect(element.querySelector(".help-tooltip-button")).not.toBeNull();+ const row = element.querySelector("li.dropdown-item");+ expect(row?.textContent).toContain("Inbox column");+ expect(row?.getAttribute("title") ?? row?.getAttribute("data-bs-original-title"))+ .toBe("Shows the notes with no column yet.");+ expect(element.querySelector(".help-tooltip-button")).toBeNull();});});