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(board): leave the collapse hint off column headings on mobile
Elian Doran19c0285148c5
diff --git a/apps/client/src/widgets/collections/board/column.tsx b/apps/client/src/widgets/collections/board/column.tsxindex 1ff55ebcad..ff7e5ca602 100644--- a/apps/client/src/widgets/collections/board/column.tsx+++ b/apps/client/src/widgets/collections/board/column.tsx@@ -393,10 +393,10 @@ export default function Column({return () => window.clearTimeout(timer);}, [ isExpanding ]);- // Only while the column is open: the strip's own press opens it, which is what it says- // instead. Memoised because `useStaticTooltip` rebuilds the tooltip on a new config.+ // Off on a strip and on mobile. Memoised: `useStaticTooltip` rebuilds on a new config.const headerTooltip = useMemo(- () => ({ title: isCollapsed ? "" : t("board_view.collapse-hint") }), [ isCollapsed ]);+ () => ({ title: isCollapsed || isMobile() ? "" : t("board_view.collapse-hint") }),+ [ isCollapsed ]);useStaticTooltip(headerRef, headerTooltip);// Reported on the way in only. A column opened by being selected closes when another one isdiff --git a/apps/client/src/widgets/collections/board/index.spec.tsx b/apps/client/src/widgets/collections/board/index.spec.tsxindex 8bbdbcb5ad..b4c5d86a5b 100644--- a/apps/client/src/widgets/collections/board/index.spec.tsx+++ b/apps/client/src/widgets/collections/board/index.spec.tsx@@ -8,7 +8,7 @@ import { useCallback, useEffect, useState } from "preact/hooks";import { act } from "preact/test-utils";import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";-import { Modal as BootstrapModal } from "bootstrap";+import { Modal as BootstrapModal, Tooltip } from "bootstrap";import appContext from "../../../components/app_context";import Component from "../../../components/component";@@ -1372,6 +1372,15 @@ describe("Board column rename", () => {expect(first.querySelector("h3 input")).toBeNull();});+ it("hints at the double click and Space on an open column's heading", async () => {+ const { container } = await setup();+ const heading = container.querySelector(".board-column h3");+ expect(heading).not.toBeNull();++ // `useStaticTooltip` installs one only where there is a title to show.+ expect(heading && Tooltip.getInstance(heading)).not.toBeNull();+ });+/** The tooltip is set on the element, which is where `useStaticTooltip` reads it back from. */function badgeTooltip(container: HTMLElement, index: number) {const badge = [ ...container.querySelectorAll(".board-column .counter-badge") ][index];@@ -5535,6 +5544,13 @@ describe("Column toolbar on mobile", () => {expect(toolbar()).toBeNull();});+ /** Neither gesture the hint names is there on a touch screen, where the rail collapses. */+ it("leaves the collapse hint off the heading", async () => {+ await setup();++ expect(Tooltip.getInstance(heading(0))).toBeNull();+ });+it("collapses and opens the column, offering only the open on a strip", async () => {await setup();await act(async () => { heading(0).focus(); });