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(client): keep the help icon's styles off the in-app help pane
Elian Dorana80dd0c9af1c
diff --git a/apps/client/src/widgets/dialogs/image_compression/image_compression_dialog.spec.tsx b/apps/client/src/widgets/dialogs/image_compression/image_compression_dialog.spec.tsxindex a30afa3624..be040b64a9 100644--- a/apps/client/src/widgets/dialogs/image_compression/image_compression_dialog.spec.tsx+++ b/apps/client/src/widgets/dialogs/image_compression/image_compression_dialog.spec.tsx@@ -151,7 +151,7 @@ const slider = () => document.body.querySelector<HTMLInputElement>(".slider");const qualityRows = () => rows().filter((row) => !!row.querySelector(".slider"));const qualityReading = () => document.body.querySelector(".image-compression-section-value")?.textContent ?? "";const toggles = () => Array.from(document.body.querySelectorAll<HTMLInputElement>(".switch-toggle"));-const hasHelp = (row: HTMLElement) => !!row.querySelector(".tn-card-option-title .contextual-help");+const hasHelp = (row: HTMLElement) => !!row.querySelector(".tn-card-option-title .contextual-help-icon");/** The buttons of one format's choice, the groups being in the order the card lists them. */const choiceButtons = (group: number) =>diff --git a/apps/client/src/widgets/react/ContextualHelp.css b/apps/client/src/widgets/react/ContextualHelp.cssindex ac8f3df6cc..4b3873b404 100644--- a/apps/client/src/widgets/react/ContextualHelp.css+++ b/apps/client/src/widgets/react/ContextualHelp.css@@ -1,5 +1,5 @@/* Small, dimmed and asking to be hovered: present without competing with what it explains. */-.contextual-help {+.contextual-help-icon {margin-inline-start: 0.25em;color: var(--contextual-help-icon-color);font-size: 0.75rem;@@ -7,13 +7,13 @@cursor: help;}-.contextual-help:hover,-.contextual-help:focus-visible {+.contextual-help-icon:hover,+.contextual-help-icon:focus-visible {opacity: 1;}/* Reached by keyboard it is the only thing being pointed at, so it says where the focus is. */-.contextual-help:focus-visible {+.contextual-help-icon:focus-visible {outline: 2px solid var(--input-focus-outline-color);outline-offset: 2px;border-radius: 2px;diff --git a/apps/client/src/widgets/react/ContextualHelp.spec.tsx b/apps/client/src/widgets/react/ContextualHelp.spec.tsxindex 1314b39983..c78c64d21c 100644--- a/apps/client/src/widgets/react/ContextualHelp.spec.tsx+++ b/apps/client/src/widgets/react/ContextualHelp.spec.tsx@@ -64,7 +64,7 @@ describe("ContextualHelp", () => {act(() => render(<ContextualHelp helpMessage="What this figure covers." />, container));const span = container.querySelector("span");- expect(span?.className).toBe("bx bx-info-circle contextual-help");+ expect(span?.className).toBe("bx bx-info-circle contextual-help-icon");// No title of its own: a native tooltip would open somewhere else, in its own styling.expect(span?.getAttribute("title")).toBeNull();@@ -133,7 +133,7 @@ describe("ContextualHelp", () => {// The same affordance, and no tooltip behind it: a phone would never show one.const span = container.querySelector("span");- expect(span?.className).toBe("bx bx-info-circle contextual-help");+ expect(span?.className).toBe("bx bx-info-circle contextual-help-icon");expect(mocks.useStaticTooltip).not.toHaveBeenCalled();expect(document.body.querySelector(".sheet-stub")).toBeNull();diff --git a/apps/client/src/widgets/react/ContextualHelp.tsx b/apps/client/src/widgets/react/ContextualHelp.tsxindex 27d77339dd..eea4e6959d 100644--- a/apps/client/src/widgets/react/ContextualHelp.tsx+++ b/apps/client/src/widgets/react/ContextualHelp.tsx@@ -123,7 +123,7 @@ function HelpIcon({ iconRef, helpMessage, popup, onActivate, onDismiss }: HelpIcreturn (<spanref={iconRef}- className="bx bx-info-circle contextual-help"+ className="bx bx-info-circle contextual-help-icon"role="button"tabIndex={0}aria-label={t("contextual_help.label", { message: helpMessage })}diff --git a/apps/client/src/widgets/type_widgets/options/media.spec.tsx b/apps/client/src/widgets/type_widgets/options/media.spec.tsxindex abff8e0719..7307a27115 100644--- a/apps/client/src/widgets/type_widgets/options/media.spec.tsx+++ b/apps/client/src/widgets/type_widgets/options/media.spec.tsx@@ -225,7 +225,7 @@ describe("the images card", () => {expect(describes("space_usage.compress_quality")).toBe("images.jpeg_quality_description");// A row with nothing extra to say keeps its help mark alone rather than inventing prose.expect(describes("space_usage.compress_png_handling")).toBeUndefined();- expect(row("space_usage.compress_png_handling")?.querySelector(".contextual-help")).not.toBeNull();+ expect(row("space_usage.compress_png_handling")?.querySelector(".contextual-help-icon")).not.toBeNull();});it("writes each choice back to the option it stands for", async () => {diff --git a/apps/client/src/widgets/type_widgets/space_usage/cleanup_dialog.spec.tsx b/apps/client/src/widgets/type_widgets/space_usage/cleanup_dialog.spec.tsxindex d8b5068d92..90d85d46ff 100644--- a/apps/client/src/widgets/type_widgets/space_usage/cleanup_dialog.spec.tsx+++ b/apps/client/src/widgets/type_widgets/space_usage/cleanup_dialog.spec.tsx@@ -263,7 +263,7 @@ describe("showCleanupDialog", () => {// Both qualifiers leave something open that their label cannot answer — how the count is// reckoned, and against what — so each carries the explanation beside its title.- expect(nestedRows().map((row) => !!row.querySelector(".cleanup-item-title .contextual-help")))+ expect(nestedRows().map((row) => !!row.querySelector(".cleanup-item-title .contextual-help-icon"))).toEqual([ true, true ]);});diff --git a/apps/client/src/widgets/type_widgets/space_usage/note_usage_donut.spec.tsx b/apps/client/src/widgets/type_widgets/space_usage/note_usage_donut.spec.tsxindex ed1f7473dd..ff4436e10f 100644--- a/apps/client/src/widgets/type_widgets/space_usage/note_usage_donut.spec.tsx+++ b/apps/client/src/widgets/type_widgets/space_usage/note_usage_donut.spec.tsx@@ -120,7 +120,7 @@ describe("NoteUsageDonut", () => {// Note, Revisions, Subtree — each says what it covers through its own icon.expect(lines).toHaveLength(3);for (const line of lines) {- const icon = line.querySelector(".contextual-help");+ const icon = line.querySelector(".contextual-help-icon");expect(icon?.classList.contains("bx-info-circle")).toBe(true);// The app's tooltip, never the browser's: a native title would style and place itself// apart from every other hint in the hole.