From 4532ab684c4324710bee599944554b929f25c426 Mon Sep 17 00:00:00 2001 From: Christian Bager Bach Houmann Date: Sat, 26 Sep 2026 18:32:12 +0200 Subject: [PATCH] fix(settings): shorten long dropdown options that crushed their labels A native select is as wide as its longest option. The launcher-row and Announce updates dropdowns had sentence-long options, so in an 800px window they squeezed their label and description to one word per line, or to nothing. The options are now short (Bottom/Top/Hidden and Every release/Feature releases/Never); stored values are unchanged. --- docs/src/content/docs/docs/Settings.md | 4 +-- src/gui/components/settingsDefinitions.ts | 13 ++++--- tests/e2e/settings-layout.test.ts | 41 +++++++++++++++++++++++ 3 files changed, 49 insertions(+), 9 deletions(-) create mode 100644 tests/e2e/settings-layout.test.ts diff --git a/docs/src/content/docs/docs/Settings.md b/docs/src/content/docs/docs/Settings.md index 308ec3ac0..7e0b05378 100644 --- a/docs/src/content/docs/docs/Settings.md +++ b/docs/src/content/docs/docs/Settings.md @@ -16,7 +16,7 @@ This page is a reference for the QuickAdd settings tab, one group at a time. Eac The choice picker is the list you see when you run **QuickAdd: Run**. - **Search nested choices** - find a choice even when it lives inside a folder. When on, searching also matches choices nested in folders and shows their path. A nested match can rank above a same-level one. Turn it off to search only the level you have open. -- **"New note from template" in the launcher** - decide where the "create a note from a template" row sits in the picker, so you can make a note from any template without building a dedicated Template choice. *Show at the bottom* (default) keeps your most-used choice in the first slot, *Show at the top* makes the template row first, and *Hide* removes it. The row only appears once you have a [template folder](#templates--properties) configured. The **New note from template** command is always in the command palette, but it needs a configured folder too - without one it shows a notice and opens these settings. +- **"New note from template" in the launcher** - decide where the "create a note from a template" row sits in the picker, so you can make a note from any template without building a dedicated Template choice. *Bottom* (default) keeps your most-used choice in the first slot, *Top* makes the template row first, and *Hidden* removes it. The row only appears once you have a [template folder](#templates--properties) configured. The **New note from template** command is always in the command palette, but it needs a configured folder too - without one it shows a notice and opens these settings. ## Input {#input} @@ -34,7 +34,7 @@ The choice picker is the list you see when you run **QuickAdd: Run**. ## Notifications {#notifications} -- **Announce updates** - see what changed when a new version installs, including new features, demo videos, and bug fixes. Choose *Show updates on each new release*, *Show updates only on major releases (new features, breaking changes)*, or *Don't show*. +- **Announce updates** - see what changed when a new version installs, including new features, demo videos, and bug fixes. Choose *Every release*, *Feature releases* (default; new features and breaking changes, not bug-fix-only releases), or *Never*. - **Show capture notifications** - get a confirmation that a capture landed. When on, QuickAdd shows a notice after content is captured successfully. - **Show input cancellation notifications** - get a notice when you dismiss a prompt without submitting. Turn it off to avoid the extra notice every time you cancel a prompt. diff --git a/src/gui/components/settingsDefinitions.ts b/src/gui/components/settingsDefinitions.ts index a241ff132..d07ab73bb 100644 --- a/src/gui/components/settingsDefinitions.ts +++ b/src/gui/components/settingsDefinitions.ts @@ -70,9 +70,9 @@ export function createSettingDefinitions( key: "templateFolderLauncherRow", defaultValue: "bottom", options: { - bottom: "Show at the bottom (keeps your top choice first)", - top: "Show at the top", - off: "Hide", + bottom: "Bottom", + top: "Top", + off: "Hidden", }, }, }, @@ -153,10 +153,9 @@ export function createSettingDefinitions( key: "announceUpdates", defaultValue: "major", options: { - all: "Show updates on each new release", - major: - "Show updates only on major releases (new features, breaking changes)", - none: "Don't show", + all: "Every release", + major: "Feature releases", + none: "Never", }, }, }, diff --git a/tests/e2e/settings-layout.test.ts b/tests/e2e/settings-layout.test.ts new file mode 100644 index 000000000..20e8514ad --- /dev/null +++ b/tests/e2e/settings-layout.test.ts @@ -0,0 +1,41 @@ +import { expect, it } from "vitest"; +import { createQuickAddE2EHarness } from "./e2eVault"; +import { waitForElement } from "./uiHelpers"; + +const getContext = createQuickAddE2EHarness("settings-layout"); + +it("leaves every dropdown's label room in an 800px window", async () => { + const { obsidian } = getContext(); + const size = await obsidian.dev.evalJson( + "require('electron').remote.getCurrentWindow().getSize()", + ); + try { + await obsidian.dev.evalJson( + "require('electron').remote.getCurrentWindow().setSize(800, 800); true", + ); + await expect.poll(() => obsidian.dev.evalJson("innerWidth")).toBe(800); + await obsidian.dev.evalJson("app.setting.open(); app.setting.openTabById('quickadd'); true"); + await waitForElement(obsidian, ".mod-settings .setting-item select"); + const rows = await obsidian.dev.evalJson>(`(() => Object.fromEntries( + [...document.querySelectorAll('.mod-settings .vertical-tab-content .setting-item')] + .filter((row) => row.querySelector(':scope > .setting-item-control > select')) + .map((row) => [ + row.querySelector('.setting-item-name').textContent, + row.querySelector(':scope > .setting-item-info').getBoundingClientRect().width / + row.getBoundingClientRect().width, + ]), + ))()`); + expect(Object.keys(rows)).toEqual( + expect.arrayContaining(["Announce updates", "“New note from template” in the launcher"]), + ); + for (const [name, share] of Object.entries(rows)) { + expect(share, name).toBeGreaterThanOrEqual(0.5); + } + } finally { + await obsidian.dev.evalJson(`(() => { + app.setting.close(); + require('electron').remote.getCurrentWindow().setSize(${size[0]}, ${size[1]}); + return true; + })()`); + } +});