Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(app): show the disabled-Test reason as text, not a title on a dead button

M3gA-Mind4dd255cbad62
diff --git a/app/src/components/settings/panels/EmbeddingsSetupModal.tsx b/app/src/components/settings/panels/EmbeddingsSetupModal.tsx
index bf54d486a7..e0aca13066 100644
--- a/app/src/components/settings/panels/EmbeddingsSetupModal.tsx
+++ b/app/src/components/settings/panels/EmbeddingsSetupModal.tsx
@@ -68,32 +68,41 @@ const EmbeddingsSetupModal = ({
contentClassName="px-5 py-4 space-y-4"
footer={
<div className="flex justify-between pt-1">
- {/* Disabled for a custom endpoint, deliberately, and with a reason
- the user can read. `setupTest` calls
+ {/* Disabled for a custom endpoint, deliberately. `setupTest` calls
`openhuman.embeddings_test_connection` with only
`{ provider, model, dimensions }` — there is no parameter for an
endpoint URL — so a custom provider has nothing to test against.
Previously the button stayed enabled and its handler opened with
`if (!isCustom)`, so a click did nothing at all: no request, no
- result, no error. A dead control that looks live is worse than an
- absent one, and worse still than an honest explanation. */}
- <Button
- variant="secondary"
- size="xs"
- onClick={onTest}
- title={
- isCustom
- ? t(
- 'settings.embeddings.testUnavailableCustom',
- 'Testing a custom endpoint is not supported yet — save it and check the status on the Embeddings panel.'
- )
- : undefined
- }
- disabled={setupTesting || setupSaving || isCustom || !setupKey.trim()}>
- {setupTesting
- ? t('settings.embeddings.testing')
- : t('settings.embeddings.testConnection')}
- </Button>
+ result, no error.
+
+ The reason is rendered as visible text beside the button, not as a
+ `title` on it. `Button` applies `disabled:pointer-events-none`
+ (ui/Button.tsx:40), so a disabled control cannot be hovered — and a
+ disabled button is out of the tab order, so a `title` is
+ unreachable by keyboard too. Text that is simply on screen needs
+ neither. */}
+ <div className="flex items-center gap-2">
+ <Button
+ variant="secondary"
+ size="xs"
+ onClick={onTest}
+ disabled={setupTesting || setupSaving || isCustom || !setupKey.trim()}>
+ {setupTesting
+ ? t('settings.embeddings.testing')
+ : t('settings.embeddings.testConnection')}
+ </Button>
+ {isCustom && (
+ <span
+ data-testid="embeddings-test-unavailable-reason"
+ className="max-w-[18rem] text-[11px] text-content-muted">
+ {t(
+ 'settings.embeddings.testUnavailableCustom',
+ 'Testing a custom endpoint is not supported yet — save it and check the status on the Embeddings panel.'
+ )}
+ </span>
+ )}
+ </div>
<div className="flex gap-2">
<Button variant="tertiary" size="xs" onClick={onClose}>
diff --git a/app/src/components/settings/panels/__tests__/EmbeddingsSetupModal.test.tsx b/app/src/components/settings/panels/__tests__/EmbeddingsSetupModal.test.tsx
index a2c4cb8b64..9aea235352 100644
--- a/app/src/components/settings/panels/__tests__/EmbeddingsSetupModal.test.tsx
+++ b/app/src/components/settings/panels/__tests__/EmbeddingsSetupModal.test.tsx
@@ -167,12 +167,23 @@ describe('EmbeddingsSetupModal — custom-endpoint branch', () => {
expect(onTest).not.toHaveBeenCalled();
});
- it('explains on hover why Test is unavailable for a custom endpoint', () => {
- // A silently disabled control is only marginally better than a dead one;
- // the reason is what makes it honest.
+ it('shows the reason as visible text, not as a title on the disabled button', () => {
+ // `Button` applies `disabled:pointer-events-none` (ui/Button.tsx:40), so a
+ // disabled control cannot be hovered, and a disabled button is out of the
+ // tab order — a `title` there is unreachable by mouse AND by keyboard.
+ // The reason is therefore rendered beside the button as ordinary text.
renderModal({ setupProvider: custom, customEndpoint: 'https://host/v1' });
- expect(testButton().getAttribute('title') ?? '').toContain('custom endpoint');
+ const reason = screen.getByTestId('embeddings-test-unavailable-reason');
+ expect(reason).toBeVisible();
+ expect(reason.textContent ?? '').toContain('custom endpoint');
+ expect(testButton()).not.toHaveAttribute('title');
+ });
+
+ it('shows no such reason for a built-in provider', () => {
+ renderModal({ setupKey: 'sk-test' });
+
+ expect(screen.queryByTestId('embeddings-test-unavailable-reason')).not.toBeInTheDocument();
});
it('leaves Save reachable for a custom endpoint', () => {