Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

fix(ui): give search-engine dropdown a wrapping layout for disabled reasons (#7359) (#7371)

Ziyang Guod67d9fef5708
diff --git a/changelog.d/7359.bugfix.md b/changelog.d/7359.bugfix.md
new file mode 100644
index 0000000000..2178b22b7f
--- /dev/null
+++ b/changelog.d/7359.bugfix.md
@@ -0,0 +1 @@
+Search-engine dropdown entries with a long `disabled_reason` no longer collapse the engine label to 0 width. The reason now wraps onto its own line below the label (`flex-wrap: wrap` on `.ldr-custom-dropdown-item`, `flex: 0 0 100%` on `.ldr-dropdown-item-disabled-reason`), and the agent-disabled copy in `research.js` is shortened so the wrapped line stays bounded. Other disabled-reason messages are unchanged (#7359).
diff --git a/src/local_deep_research/web/static/css/custom_dropdown.css b/src/local_deep_research/web/static/css/custom_dropdown.css
index 361947b821..50e232b3ea 100644
--- a/src/local_deep_research/web/static/css/custom_dropdown.css
+++ b/src/local_deep_research/web/static/css/custom_dropdown.css
@@ -105,6 +105,12 @@ body.ldr-dropdown-active {
font-size: 0.8em;
color: var(--text-muted, #8a8aa0);
font-style: italic;
+ /* Issue #7359: force the reason onto its own full-width row so
+ a long copy (~127 chars for the agent-disabled message) can't
+ squeeze the label out of the flex row. The 100% basis
+ participates in wrap from the parent .ldr-custom-dropdown-item
+ and takes the next line below the label. */
+ flex: 0 0 100%;
}
.ldr-custom-dropdown-item .ldr-highlight {
@@ -152,16 +158,36 @@ body.ldr-dropdown-active {
white-space: nowrap;
}
+/* Issue #7359 round 2: the label's flex basis is 0, so a star-less row
+ where the reason takes 100% of the remaining width fits on one line
+ exactly and never wraps, leaving the label at 0 px. Forcing a 1 px
+ minimum on the disabled-row label guarantees the wrap regardless of
+ whether a star is present, and keeps long labels truncating with an
+ ellipsis (the white-space: nowrap above still applies). */
+.ldr-custom-dropdown-item--disabled .ldr-dropdown-item-label {
+ min-width: 1px;
+}
+
/* Make dropdown items flex when containing stars */
.ldr-custom-dropdown-item:has(.ldr-dropdown-favorite-star) {
display: flex;
align-items: center;
+ /* Issue #7359: when a long disabled_reason appears as a second
+ flex item it competes for horizontal space with the label,
+ squeezing the label to 0 width. Wrap so the reason takes its
+ own full-width line (the visually-intended "dim second line"
+ design). align-content keeps the wrapped layout vertically
+ anchored when only the label line is present. */
+ flex-wrap: wrap;
+ align-content: center;
}
/* Fallback for browsers that don't support :has() */
.ldr-custom-dropdown-item {
display: flex;
align-items: center;
+ flex-wrap: wrap;
+ align-content: center;
}
/* Band/group header rows (non-selectable section dividers) */
diff --git a/src/local_deep_research/web/static/js/components/research.js b/src/local_deep_research/web/static/js/components/research.js
index 11a92fbda5..5dc6ab297d 100644
--- a/src/local_deep_research/web/static/js/components/research.js
+++ b/src/local_deep_research/web/static/js/components/research.js
@@ -2812,7 +2812,20 @@
// surface (the collection details page), so the message can name
// it directly without ambiguity.
function agentEnabledToDisabledReason(_engine) {
- return `Hidden from the LangGraph research agent's tool list (check “Available to the research agent” on the collection page to re-enable).`;
+ // Issue #7359: the previous copy ("Hidden from the LangGraph
+ // research agent's tool list (check ... on the collection page
+ // to re-enable).") was ~127 chars and was rendered as a
+ // second flex item in the same row as the label, which
+ // squeezed the label to 0 width on the New Research page's
+ // Search Engine dropdown. The fix is to let the reason wrap
+ // onto its own line (custom_dropdown.css, with a 1 px label
+ // floor so the row wraps even without a favorite star) and
+ // shorten the copy so the second line stays bounded in the
+ // most common case. The "re-enable on the collection page"
+ // wording is the user-collection path; built-in engines live
+ // in settings and are re-enabled there, which the next PR
+ // will surface as a separate string.
+ return `Hidden from the LangGraph research agent — re-enable on the collection page.`;
}
// Pre-configured favorites used as the dropdown's default selection
diff --git a/tests/js/components/custom-dropdown.test.js b/tests/js/components/custom-dropdown.test.js
index 1a224b77dd..eb8c883ae8 100644
--- a/tests/js/components/custom-dropdown.test.js
+++ b/tests/js/components/custom-dropdown.test.js
@@ -1050,4 +1050,109 @@ describe('disabled options (issue #5204)', () => {
expect(reason.textContent).toMatch(/not a local source under Private only/);
dd.destroy();
});
+
+ it('keeps the label measurable when a long disabled_reason is present (#7359)', () => {
+ // The pre-fix .ldr-custom-dropdown-item was a flex row; the
+ // reason was a sibling flex item in the same row, so a long
+ // reason (~127 chars for the agent-disabled message) competed
+ // for horizontal space and squeezed the label to 0 width on a
+ // 460px-wide dropdown. The fix in custom_dropdown.css wraps
+ // the item (`flex-wrap: wrap`) and forces the reason onto its
+ // own row (`flex: 0 0 100%` on the reason selector). happy-dom
+ // does not resolve `flex-wrap` / `flex-basis` from the
+ // external stylesheet, so this test pins the DOM contract that
+ // the CSS rule assumes: the label and the reason are siblings
+ // under the same item, the reason has the class
+ // `ldr-dropdown-item-disabled-reason` (the CSS selector's
+ // target), and the label is `ldr-dropdown-item-label` (its
+ // sibling under the flex container). The CSS wrap + basis is
+ // a real-browser visual fix; a layout-level regression here
+ // would not be caught in jsdom but is verifiable in
+ // Playwright (and the project already pins the visible
+ // behavior in the accessibility suites).
+ const longReason =
+ "Hidden from the LangGraph research agent's tool list " +
+ "(check “Available to the research agent” on the collection " +
+ "page to re-enable).";
+ const options = [
+ {
+ value: 'library',
+ label: 'Library',
+ disabled: true,
+ disabled_reason: longReason,
+ },
+ ];
+ const dd = setupCustomDropdown(input, dropdownList, () => options, onSelect);
+
+ const [lib] = openList();
+ const label = lib.querySelector('.ldr-dropdown-item-label');
+ const reason = lib.querySelector('.ldr-dropdown-item-disabled-reason');
+
+ // The label and reason must be present and siblings under
+ // the same flex container — that is the contract the
+ // custom_dropdown.css wrap rule assumes.
+ expect(label).not.toBeNull();
+ expect(reason).not.toBeNull();
+ expect(label.parentElement).toBe(reason.parentElement);
+ // The reason selector must match — the CSS rule in
+ // custom_dropdown.css targets exactly this class.
+ expect(reason.classList.contains('ldr-dropdown-item-disabled-reason')).toBe(true);
+ // The label is rendered with the class the layout CSS targets
+ // for the flex: 1 / min-width: 0 sizing.
+ expect(label.classList.contains('ldr-dropdown-item-label')).toBe(true);
+ // The full reason text reaches the DOM (the original bug
+ // pinned it was "DOM still has the text but the label is
+ // squeezed" — we want both the DOM and the layout to be
+ // correct, not just one).
+ expect(reason.textContent).toBe(longReason);
+ dd.destroy();
+ });
+
+ it('keeps the label measurable on a star-less row (#7359 round 2)', () => {
+ // Round 2 of the same issue: the round-1 fix added
+ // `flex: 0 0 100%` to the reason, which on a star-less row
+ // (no onFavoriteToggle) where the label's flex basis is 0
+ // made the label shrink to 0 px (the row never wrapped).
+ // The round-2 fix adds `min-width: 1px` to the label in the
+ // disabled-row selector, forcing a wrap regardless of whether
+ // a favorite star is present. This test pins the DOM
+ // contract for the new CSS rule.
+ const longReason =
+ "Hidden from the LangGraph research agent's tool list " +
+ "(check the collection page to re-enable).";
+ const options = [
+ {
+ value: 'provider',
+ label: 'OpenAI',
+ disabled: true,
+ disabled_reason: longReason,
+ },
+ ];
+ // No onFavoriteToggle → no star in the rendered item.
+ const dd = setupCustomDropdown(input, dropdownList, () => options, onSelect);
+
+ const [row] = openList();
+ // No star present in the rendered row.
+ expect(row.querySelector('.ldr-dropdown-favorite-star')).toBeNull();
+ const label = row.querySelector('.ldr-dropdown-item-label');
+ const reason = row.querySelector('.ldr-dropdown-item-disabled-reason');
+ expect(label).not.toBeNull();
+ expect(reason).not.toBeNull();
+ // The label and reason are still siblings under the same
+ // flex container, so the round-1 wrap assumption holds.
+ expect(label.parentElement).toBe(reason.parentElement);
+ // The reason carries the class the round-1 CSS targets.
+ expect(reason.classList.contains('ldr-dropdown-item-disabled-reason')).toBe(true);
+ // The label is rendered with the class the round-2 CSS
+ // targets for `min-width: 1px`. The selector the CSS uses is
+ // `.ldr-custom-dropdown-item--disabled .ldr-dropdown-item-label`,
+ // so both ancestor and descendant classes must be present on
+ // the rendered DOM (this is the structural pin the new rule
+ // assumes). The actual computed `min-width` is enforced by
+ // the stylesheet, not happy-dom, but the classes are enough
+ // to catch a regression in the renderer.
+ expect(row.classList.contains('ldr-custom-dropdown-item--disabled')).toBe(true);
+ expect(label.classList.contains('ldr-dropdown-item-label')).toBe(true);
+ dd.destroy();
+ });
});