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(include-note): drop the box size tooltips and shrink their names
Elian Doran97d5a03ef0ef
diff --git a/apps/client/src/widgets/dialogs/content_embed.css b/apps/client/src/widgets/dialogs/content_embed.cssindex 034e9cd2ad..70f756d050 100644--- a/apps/client/src/widgets/dialogs/content_embed.css+++ b/apps/client/src/widgets/dialogs/content_embed.css@@ -41,11 +41,21 @@.btn {flex: 1;}++ .tn-segmented-choice-glyph-label {+ font-size: .8em;+ }}+ /* Bootstrap's `.visually-hidden`, so a screen reader still names each button. */@container (max-width: 400px) {.include-note-size-choice .tn-segmented-choice-glyph-label {- display: none;+ position: absolute;+ width: 1px;+ height: 1px;+ overflow: hidden;+ clip: rect(0, 0, 0, 0);+ white-space: nowrap;}}}diff --git a/apps/client/src/widgets/dialogs/content_embed.spec.tsx b/apps/client/src/widgets/dialogs/content_embed.spec.tsxindex a643f87a4c..a089ae2087 100644--- a/apps/client/src/widgets/dialogs/content_embed.spec.tsx+++ b/apps/client/src/widgets/dialogs/content_embed.spec.tsx@@ -65,11 +65,12 @@ describe("ContentEmbedDialog", () => {function checkedSize() {const active = sizeButtons().filter((button) => button.classList.contains("active"));if (active.length !== 1) throw new Error(`${active.length} box sizes are active.`);- return /^include_note\.size_(\w+)$/.exec(active[0]?.title ?? "")?.[1];+ return /^include_note\.size_(\w+)$/.exec(active[0]?.textContent?.trim() ?? "")?.[1];}async function choose(size: string) {- const button = sizeButtons().find((b) => b.title === `include_note.size_${size}`);+ const button = sizeButtons()+ .find((b) => b.textContent?.trim() === `include_note.size_${size}`);if (!button) throw new Error(`No button for ${size}.`);await act(async () => button.click());}@@ -94,6 +95,8 @@ describe("ContentEmbedDialog", () => {"include_note.size_full", "include_note.size_expandable"]);expect(sizeButtons().every((button) => button.querySelector("svg"))).toBe(true);+ // The name is written on the button, so a tooltip would only repeat it.+ expect(sizeButtons().some((button) => button.hasAttribute("title"))).toBe(false);// Every description is laid out, so the row keeps the height of the longest; only the// chosen one is shown.diff --git a/apps/client/src/widgets/dialogs/content_embed.tsx b/apps/client/src/widgets/dialogs/content_embed.tsxindex 77d68ac021..18c770cf7e 100644--- a/apps/client/src/widgets/dialogs/content_embed.tsx+++ b/apps/client/src/widgets/dialogs/content_embed.tsx@@ -85,7 +85,6 @@ export default function ContentEmbedDialog() {options={BOX_SIZES.map((size) => ({value: size,label: t(`include_note.size_${size}`),- title: t(`include_note.size_${size}`),glyph: <BoxSizeGlyph size={size} />}))}currentValue={boxSize}