diff --git a/frontend/scripts/controls-browser.mjs b/frontend/scripts/controls-browser.mjs index 7430eb6b..6ef9bfd2 100644 --- a/frontend/scripts/controls-browser.mjs +++ b/frontend/scripts/controls-browser.mjs @@ -41,6 +41,20 @@ try { assert.equal(await page.evaluate(() => window.controlEvents.submits), 2, 'implicit submit behavior changed'); await page.locator('#shared-disabled').evaluate((node) => node.click()); assert.equal(await page.evaluate(() => window.controlEvents.clicks), 2, 'disabled button fired'); + // disabledReason: aria-disabled (not native), focusable, inert on click/Enter (no click, no + // implicit submit), reason in the accessible description and tooltip on focus and on tap. + const reason = page.locator('#shared-reason'); + assert.equal(await reason.getAttribute('aria-disabled'), 'true'); + assert.equal(await reason.getAttribute('disabled'), null); + await reason.focus(); + assert.equal(await page.evaluate(() => document.activeElement.id), 'shared-reason', 'reasoned button must be focusable'); + await page.locator('[role="tooltip"]', { hasText: 'Install it first' }).first().waitFor(); + await page.keyboard.press('Escape'); + await reason.click({ force: true }); + await reason.press('Enter'); + assert.deepEqual(await page.evaluate(() => window.controlEvents), { submits: 2, clicks: 2 }, 'reasoned button fired or submitted'); + assert.equal(await reason.evaluate((node) => document.getElementById(node.getAttribute('aria-describedby').split(' ').pop()).textContent), 'Install it first'); + await page.locator('[role="tooltip"]', { hasText: 'Install it first' }).first().waitFor(); assert.equal(await page.locator('#shared-link').evaluate((node) => node.tagName), 'A'); assert.equal(await page.locator('#shared-link').getAttribute('href'), '#destination'); assert.deepEqual(errors, []); diff --git a/frontend/scripts/file-manager-browser.mjs b/frontend/scripts/file-manager-browser.mjs index cf92b3d3..55f9c42e 100644 --- a/frontend/scripts/file-manager-browser.mjs +++ b/frontend/scripts/file-manager-browser.mjs @@ -163,7 +163,8 @@ try { await late.evaluate(() => window.release('/home/projects')); await late.waitForTimeout(100); assert.equal(await late.getByText('inside-projects.txt').count(), 0); - assert.equal(await late.getByTitle('Back', { exact: true }).isDisabled(), true, + // Back carries a disabledReason, so it is aria-disabled (focusable), not natively disabled. + assert.equal(await late.getByRole('button', { name: 'Back', exact: true }).getAttribute('aria-disabled'), 'true', 'navigation history must not cross storage targets'); console.log('PASS late local responses and history cannot cross a target switch'); @@ -346,7 +347,7 @@ try { await deepLink.evaluate(() => window.release('/var/www')); await deepLink.getByText('inside-www.txt', { exact: true }).waitFor(); assert.equal(await deepLink.getByText('projects', { exact: true }).count(), 0); - assert.equal(await deepLink.getByTitle('Back', { exact: true }).isDisabled(), true); + assert.equal(await deepLink.getByRole('button', { name: 'Back', exact: true }).getAttribute('aria-disabled'), 'true'); console.log('PASS initial deep links retain their directory and history'); const clearing = await browser.newPage(); diff --git a/frontend/src/components/LogViewer.jsx b/frontend/src/components/LogViewer.jsx index 87ec906f..3da35dc9 100644 --- a/frontend/src/components/LogViewer.jsx +++ b/frontend/src/components/LogViewer.jsx @@ -121,7 +121,7 @@ export function LogViewer({ )} {onClear && ( - )} diff --git a/frontend/src/components/backups/BackupHistoryList.jsx b/frontend/src/components/backups/BackupHistoryList.jsx index 963ee2ca..8cf3f030 100644 --- a/frontend/src/components/backups/BackupHistoryList.jsx +++ b/frontend/src/components/backups/BackupHistoryList.jsx @@ -187,7 +187,7 @@ export default function BackupHistoryList({ hideable: false, render: (run) => (
e.stopPropagation()}> - + {run.remote_key && ( )} diff --git a/frontend/src/components/file-manager/FileManagerToolbar.jsx b/frontend/src/components/file-manager/FileManagerToolbar.jsx index 78a21e20..736ed32f 100644 --- a/frontend/src/components/file-manager/FileManagerToolbar.jsx +++ b/frontend/src/components/file-manager/FileManagerToolbar.jsx @@ -82,6 +82,7 @@ export default function FileManagerToolbar({ className="nav-btn" onClick={goBack} disabled={historyIdx === 0} + disabledReason={t('app.fileManager.nothingToGoBackTo', 'Nothing to go back to')} title={t('common.actions.back', 'Back')} > @@ -92,6 +93,7 @@ export default function FileManagerToolbar({ className="nav-btn" onClick={goForward} disabled={historyIdx >= history.length - 1} + disabledReason={t('app.fileManager.nothingToGoForwardTo', 'Nothing to go forward to')} title={t('app.fileManager.forward', 'Forward')} > diff --git a/frontend/src/components/log-viewer/LogToolbar.jsx b/frontend/src/components/log-viewer/LogToolbar.jsx index 812d1911..023a5525 100644 --- a/frontend/src/components/log-viewer/LogToolbar.jsx +++ b/frontend/src/components/log-viewer/LogToolbar.jsx @@ -12,7 +12,7 @@ export default function LogToolbar({ wrapLines, onToggleWrap, isFullscreen, onToggleFullscreen, onRefresh, onDownload, onClear, onScrollToBottom, - canAct, + canAct, actDisabledReason, }) { const { t } = useTranslation(); return ( @@ -56,6 +56,7 @@ export default function LogToolbar({ className={`lv-chip ${autoRefresh ? 'active' : ''}`} onClick={onAutoRefreshToggle} disabled={!canAct} + disabledReason={actDisabledReason} title={t('app.logToolbar.autoRefreshEvery3sAndFollow', 'Auto-refresh every 3s and follow tail')} > @@ -79,6 +80,7 @@ export default function LogToolbar({ className="lv-icon-btn" onClick={onScrollToBottom} disabled={!canAct} + disabledReason={actDisabledReason} title={t('app.logToolbar.jumpToEnd', 'Jump to end')} > @@ -87,6 +89,7 @@ export default function LogToolbar({ className="lv-icon-btn" onClick={onRefresh} disabled={!canAct} + disabledReason={actDisabledReason} title={t('common.actions.refresh', 'Refresh')} > @@ -95,6 +98,7 @@ export default function LogToolbar({ className="lv-icon-btn" onClick={onDownload} disabled={!canAct} + disabledReason={actDisabledReason} title={t('common.actions.download', 'Download')} > @@ -103,6 +107,7 @@ export default function LogToolbar({ className="lv-icon-btn danger" onClick={onClear} disabled={!canAct} + disabledReason={actDisabledReason} title={t('app.logToolbar.truncateLogFile', 'Truncate log file')} > diff --git a/frontend/src/components/monitoring/FleetCapacityPanel.jsx b/frontend/src/components/monitoring/FleetCapacityPanel.jsx index 4a2d5925..fe206eb7 100644 --- a/frontend/src/components/monitoring/FleetCapacityPanel.jsx +++ b/frontend/src/components/monitoring/FleetCapacityPanel.jsx @@ -184,10 +184,10 @@ export default function FleetCapacityPanel({ scope, refreshKey = 0 }) {

{t('app.fleetCapacityPanel.serverComparison', 'Server comparison')}

- -
@@ -305,7 +305,7 @@ export default function FleetCapacityPanel({ scope, refreshKey = 0 }) {

{t('app.fleetCapacityPanel.capacityForecast', 'Capacity forecast')}

-
diff --git a/frontend/src/components/proxy/ProxyStackPanel.jsx b/frontend/src/components/proxy/ProxyStackPanel.jsx index 65fd1d2a..3b8bfd79 100644 --- a/frontend/src/components/proxy/ProxyStackPanel.jsx +++ b/frontend/src/components/proxy/ProxyStackPanel.jsx @@ -246,7 +246,7 @@ const ProxyStackPanel = ({ serverId }) => { onChange={setSelectedType} />
- diff --git a/frontend/src/components/settings/SystemTab.jsx b/frontend/src/components/settings/SystemTab.jsx index eee545d5..a7868ff9 100644 --- a/frontend/src/components/settings/SystemTab.jsx +++ b/frontend/src/components/settings/SystemTab.jsx @@ -283,6 +283,7 @@ const SystemTab = () => { variant="default" onClick={handleTimezoneChange} disabled={savingTimezone || !selectedTimezone || selectedTimezone === metrics?.time?.timezone_id} + disabledReason={!savingTimezone ? t('app.systemTab.selectADifferentTimezoneFirst', 'Select a different timezone first') : undefined} > {savingTimezone ? t('common.saving', 'Saving…') : t('app.systemTab.apply', 'Apply')} @@ -374,6 +375,7 @@ const SystemTab = () => { variant="default" onClick={handleSaveCanonicalDomain} disabled={savingDomain || !canonicalDomain} + disabledReason={!savingDomain ? t('app.systemTab.enterADomainFirst', 'Enter a domain first') : undefined} > {savingDomain ? t('common.saving', 'Saving…') : t('app.systemTab.saveCanonicalDomain', 'Save canonical domain')} diff --git a/frontend/src/components/ui/button.jsx b/frontend/src/components/ui/button.jsx index 6227a455..ed3781f2 100644 --- a/frontend/src/components/ui/button.jsx +++ b/frontend/src/components/ui/button.jsx @@ -2,6 +2,15 @@ import * as React from 'react'; import { Slot } from '@radix-ui/react-slot'; import { buttonVariants } from './buttonVariants'; import { Spinner } from '../Spinner'; +import { Tooltip, TooltipTrigger, TooltipContent } from './tooltip'; + +// Why is this button off? +// disabled because of a missing prerequisite → pass `disabledReason` (short, +// says what to do: "Install Certbot first"). The button gets aria-disabled +// instead of the native attribute, so it stays focusable and hoverable and +// the reason shows in a tooltip (hover, focus, tap) and is read by screen +// readers. Clicks are swallowed. +// disabled only while a request runs → use `loading`, no reason needed. // forwardRef is load-bearing, not ceremony: every Radix trigger used as // `
-
diff --git a/frontend/src/pages/CloudProvision.jsx b/frontend/src/pages/CloudProvision.jsx index 78dad03c..e49c882e 100644 --- a/frontend/src/pages/CloudProvision.jsx +++ b/frontend/src/pages/CloudProvision.jsx @@ -242,7 +242,7 @@ const CloudProvision = () => { footer={( <> - + )} > diff --git a/frontend/src/pages/DatabaseMigration.jsx b/frontend/src/pages/DatabaseMigration.jsx index 201b70a9..39c2f6a5 100644 --- a/frontend/src/pages/DatabaseMigration.jsx +++ b/frontend/src/pages/DatabaseMigration.jsx @@ -344,6 +344,7 @@ const DatabaseMigration = () => { className="btn-wizard-next" onClick={() => setCurrentStep(3)} disabled={!backupResult?.success} + disabledReason={t('app.databaseMigration.createABackupFirst', 'Create a backup first')} > {t('common.actions.continue', 'Continue')} diff --git a/frontend/src/pages/Databases.jsx b/frontend/src/pages/Databases.jsx index 6b0f0e4e..26ccbdb4 100644 --- a/frontend/src/pages/Databases.jsx +++ b/frontend/src/pages/Databases.jsx @@ -892,8 +892,9 @@ export default function Databases() { type="button" className="dbx-tab dbx-tab-new" disabled={!newConsoleConn} + disabledReason={t('app.databases.selectADatabaseToOpenA', 'Select a database to open a console')} onClick={() => { if (newConsoleConn) openConsole(newConsoleConn, selectedNode.engine); }} - title={newConsoleConn ? t('app.databases.newSqlConsole', 'New SQL console') : t('app.databases.selectADatabaseToOpenA', 'Select a database to open a console')} + title={newConsoleConn ? t('app.databases.newSqlConsole', 'New SQL console') : undefined} aria-label={t('app.databases.newSqlConsole', 'New SQL console')} >