diff --git a/src/client/clues/tab/CluesTab.tsx b/src/client/clues/tab/CluesTab.tsx index fa52e5eb..a3562f76 100644 --- a/src/client/clues/tab/CluesTab.tsx +++ b/src/client/clues/tab/CluesTab.tsx @@ -31,7 +31,7 @@ import { t } from '../../locales.ts' import { CluePacksSection } from './packs.tsx' import { ClueBrowser } from './browser.tsx' import { ClueHelpOverlay, clueHelpSeen, markClueHelpSeen } from './help.tsx' -import { IconButton, SidebarToolbar, WorkbenchSection } from '../../ui/index.ts' +import { ActionButton, EmptyState, IconButton, SidebarToolbar, WorkbenchSection } from '../../ui/index.ts' import { openClueDetailWindow, type ClueDetailTarget } from '../windows/detail.tsx' import { openClueCollectionForTarget } from '../windows/collect.tsx' import { openPackManagementWindow } from '../windows/pack.tsx' @@ -361,15 +361,11 @@ export function CluesTab({ ctx, store, scope, visible }: CluesTabProps): ReactNo )} {resolved && workspaceId === undefined && ( -
- {t('clueTabNoWorkspace')} - -
+ {t('retry')}} /> )} {resolved && workspaceId !== undefined && !ready && ( -
- {t('clueTabUnavailable')} -
+ )} {ready && browseWorkspaceId !== undefined && ( diff --git a/src/client/clues/tab/browser-shared.tsx b/src/client/clues/tab/browser-shared.tsx index 49ee1842..cc81e701 100644 --- a/src/client/clues/tab/browser-shared.tsx +++ b/src/client/clues/tab/browser-shared.tsx @@ -20,7 +20,7 @@ import type { import { BUILTIN_SOURCE_IDS } from '../../../clues/types.ts' import { parseGithubRepoRef } from '../../../clues/sources/github/url.ts' import { t } from '../../locales.ts' -import { SourceSwitcher, TextInput } from '../../ui/index.ts' +import { Field, SourceSwitcher, TextInput } from '../../ui/index.ts' import css from './clues-tab.module.css' /** Stable row key of one candidate (the locator is source-normalized JSON). */ @@ -278,15 +278,14 @@ export function ScopeFields(props: { if (sourceId === BUILTIN_SOURCE_IDS.githubIssues || sourceId === BUILTIN_SOURCE_IDS.githubPulls) { return ( <> - +
{t('clueBrowserScopeGithubState')} {([ @@ -323,39 +322,36 @@ export function ScopeFields(props: { ))}
{form.docsKind === 'drive' && ( - + )} {form.docsKind === 'wiki' && ( - + )} ) } return ( - + ) } diff --git a/src/client/clues/tab/browser.tsx b/src/client/clues/tab/browser.tsx index bd8f261b..01211150 100644 --- a/src/client/clues/tab/browser.tsx +++ b/src/client/clues/tab/browser.tsx @@ -1027,16 +1027,11 @@ export function ClueBrowser(props: ClueBrowserProps): ReactNode { refresh must not insert a row above the search box. */} {cataloguePhase === 'loading' && sources.length === 0 && } {cataloguePhase === 'error' && sources.length === 0 && ( -
- {catalogueError ?? t('error')} - -
+ { void loadCatalogue() }} /> )} {cataloguePhase === 'ready' && enabled.length === 0 && ( -
- {t('clueBrowserAllDisabled')} - -
+ {t('clueBrowserOpenSettings')}} /> )} {enabled.length > 0 && active !== undefined && ( @@ -1092,10 +1087,7 @@ export function ClueBrowser(props: ClueBrowserProps): ReactNode { windows={windows} visible={visible} onReady={() => { void run(view, undefined, false, { auto: true }) }} /> {cataloguePhase === 'error' && sources.length > 0 && ( -
- {catalogueError ?? t('error')} - -
+ { void loadCatalogue() }} /> )} {showScopeEditor && active.sourceId !== BUILTIN_SOURCE_IDS.feishuTasks && ( - {t('clueBrowserPinsFailed')} - - + { + const retryButton = event.currentTarget + setPinsRetrying(true) + void refreshLocal().then(loaded => { + setPinsRetrying(false) + if (loaded && visibleRef.current && document.activeElement === retryButton) queryInputRef.current?.focus() + }) + }} /> )} {pinnedRows.length > 0 && {refresh.kind === 'error' && ( -
- {refresh.message} - -
+ { + const last = lastRequestRef.current + void run(last.view, last.cursor, false, { force: true }) + }} /> )} - {state.kind === 'idle' &&
{t('clueBrowserSearchNeeded')}
} + {state.kind === 'idle' && } {state.kind === 'loading' && } {state.kind === 'needs-scope' && ( -
- {state.reason === 'search' ? t('clueBrowserSearchScopeNeeded') : t('clueScopeNoDefault')} - -
+ { setScopeOpen(true) }}>{t('clueBrowserScopeEdit')}} /> )} {state.kind === 'unsupported' && ( -
- {state.reason === 'no-list' ? t('clueBrowserUnsupported') : t('clueBrowserSearchUnsupported')} -
+ )} {state.kind === 'error' && ( -
- {state.message} - -
+ { + const last = lastRequestRef.current + void run(last.view, last.cursor, false, { force: true }) + }} /> )} {state.kind === 'page' && state.result.items.length === 0 && ( )} {state.kind === 'resolved' && state.candidates.length === 0 && ( -
{t('clueBrowserResolveEmpty')}
+ )} {state.kind === 'page' && state.view.kind === 'search' @@ -1395,43 +1367,26 @@ function PinsPanel(props: {
    {pinned.map((row, index) => ( -
  • { props.onContextMenu(event, row) }} onKeyDown={event => { props.onMenuKey(event, row) }}> - - - - - - + titleLabel={row.title} + titleAs="button" + primary={navigation.itemTabIndex(index) === 0} + onTitleClick={() => { props.onOpenDetail(row) }} + leading={} + subtitle={<>{row.info?.state === undefined ? props.displayName(row.sourceId) : null}} + actions={<> + { props.onInsert(row) }} + icon={} /> + { props.onUnpin(row) }} + icon={} /> + } + />
  • ))}
diff --git a/src/client/clues/tab/clues-tab.module.css b/src/client/clues/tab/clues-tab.module.css index e7652b9c..5d8bc525 100644 --- a/src/client/clues/tab/clues-tab.module.css +++ b/src/client/clues/tab/clues-tab.module.css @@ -29,39 +29,6 @@ font-size: 12px; line-height: 16px; } -.viewTabs { - display: flex; - flex: 1 1 180px; - min-width: 0; - gap: 2px; - padding: 2px; - border: 1px solid var(--dsw-alias-border-l1); - border-radius: var(--ds-sidebar-radius); - background: var(--dsw-alias-bg-base); - overflow-x: auto; - overflow-y: hidden; - overscroll-behavior-x: contain; - scrollbar-width: thin; -} -.viewTabs > button { - display: inline-flex; - flex: none; - align-items: center; - gap: 6px; - white-space: nowrap; -} -.viewTabs.viewTabs > button[aria-selected='true'] { - background: var(--dsw-alias-interactive-bg-active); - color: var(--dsw-alias-label-primary); -} -.headerActions { - display: flex; - align-items: center; - justify-content: flex-end; - flex: 0 0 auto; - min-width: 0; - gap: var(--ds-sidebar-space-1); -} .workspaceSelect { flex: 1 1 auto; max-width: 100%; @@ -115,23 +82,10 @@ flex-direction: column; min-height: 0; } -.sectionTools { - display: flex; - flex-wrap: wrap; - align-items: center; - gap: 4px; - min-width: 0; -} -.sectionTools .iconButton[aria-expanded='true'], -.sectionTools .iconButton[data-filtered='true'] { - background: var(--dsw-alias-interactive-bg-active); - color: var(--dsw-alias-label-primary); -} .iconButton { composes: iconButton iconButtonMd from '../../ui/kit.module.css'; } .toolButton { composes: button from '../../ui/kit.module.css'; } -.stateAction { composes: button from '../../ui/kit.module.css'; } .primaryButton { composes: buttonPrimary from '../../ui/kit.module.css'; background: var(--dsw-alias-button-primary-fill); @@ -149,7 +103,6 @@ } .iconButton:hover:not(:disabled), .toolButton:hover:not(:disabled):not([aria-disabled='true']), -.stateAction:hover:not(:disabled), .scopeButton:hover { background: var(--dsw-alias-interactive-bg-hover); color: var(--dsw-alias-label-primary); @@ -162,18 +115,15 @@ .toolButton:disabled, .toolButton[aria-disabled='true'], .primaryButton:disabled, -.querySubmit:disabled, -.stateAction:disabled { +.querySubmit:disabled { opacity: 0.4; cursor: default; } .iconButton:focus-visible, .toolButton:focus-visible, .primaryButton:focus-visible, -.stateAction:focus-visible, .workspaceSelect:focus-visible, -.scopeButton:focus-visible, -.rowTitle:focus-visible { +.scopeButton:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 1px; } @@ -185,49 +135,6 @@ padding: 4px var(--ds-sidebar-gutter) 6px; } .packSearch { flex: 1 1 160px; min-width: 0; } -.searchBox { - display: inline-flex; - align-items: center; - gap: var(--ds-sidebar-space-2); - flex: 1; - min-width: 0; - box-sizing: border-box; - min-height: var(--ds-sidebar-control-height); - padding: 4px 8px; - border: 1px solid var(--dsw-alias-border-l2); - border-radius: var(--ds-sidebar-radius); - background: var(--dsw-alias-bg-base); - color: var(--dsw-alias-label-tertiary); -} -.searchBox > svg { - flex: none; -} -.searchInput, -.searchBox .searchInput { - flex: 1; - min-height: 20px; - width: 100%; - min-width: 0; - padding: 0; - border: 0; - background: transparent; - color: var(--dsw-alias-label-primary); - font: inherit; - font-size: 13px; - line-height: 20px; -} -.searchBox:has(.searchInput:focus-visible), -.queryRow:has(.searchInput:focus-visible) { - outline: 2px solid var(--dsw-alias-brand-primary); - outline-offset: 1px; -} -.searchInput:focus-visible, -.searchBox .searchInput:focus-visible { - outline: none; -} -.textInput { - composes: input from '../../ui/kit.module.css'; -} .packList { display: flex; flex-direction: column; @@ -316,18 +223,15 @@ .scopeChoice > span { overflow-wrap: anywhere; } -.scopeChoice:has(input:checked), -.destinationRow:has(input:checked) { +.scopeChoice:has(input:checked) { background: var(--dsw-alias-interactive-bg-active); color: var(--dsw-alias-label-primary); } -.scopeChoice input, -.destinationRow input { +.scopeChoice input { flex: none; accent-color: var(--dsw-alias-state-business-primary, var(--dsw-alias-label-secondary)); } -.scopeChoice:has(input:focus-visible), -.destinationRow:has(input:focus-visible) { +.scopeChoice:has(input:focus-visible) { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: -2px; } @@ -365,13 +269,6 @@ align-items: center; gap: var(--ds-sidebar-space-2); } -.field { - display: flex; - flex-direction: column; - gap: 4px; - min-width: 0; - flex: 1 1 150px; -} .fieldLabel { color: var(--dsw-alias-label-tertiary); font-size: 11px; @@ -405,27 +302,6 @@ padding: 0; list-style: none; } -.resultRow, -.pinRow { - display: flex; - align-items: center; - gap: 6px; - box-sizing: border-box; - min-width: 0; - min-height: 30px; - padding: 0 6px; - border-radius: 4px; -} -.resultRow:hover, -.resultRow:focus-within, -.pinRow:hover, -.pinRow:focus-within { - background: var(--dsw-alias-interactive-bg-hover); -} -.resultRow[data-selected='true'], -.pinRow[data-selected='true'] { - background: var(--dsw-alias-interactive-bg-active); -} .rowSelection, .rowGlyph { flex: none; @@ -443,68 +319,7 @@ display: inline-flex; color: var(--dsw-alias-label-secondary); } -.rowTitle { - display: flex; - flex-direction: column; - align-items: flex-start; - flex: 1; - min-width: 0; - gap: var(--ds-sidebar-space-1); - padding: 0; - border: 0; - border-radius: var(--ds-sidebar-radius); - background: transparent; - color: var(--dsw-alias-label-primary); - font: inherit; - text-align: start; - cursor: pointer; -} -.rowName { - display: -webkit-box; - -webkit-box-orient: vertical; - -webkit-line-clamp: 1; - max-width: 100%; - overflow: hidden; - overflow-wrap: anywhere; - font-size: 13px; - line-height: 20px; -} -.rowSubtitle { - max-width: 100%; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - color: var(--dsw-alias-label-tertiary); - font-size: 11px; - line-height: 16px; -} -.rowActions { - display: inline-flex; - align-items: center; - gap: 2px; - flex: none; - opacity: 0; - transition: opacity 100ms ease; -} -.resultRow:hover .rowActions, -.resultRow:focus-within .rowActions, -.pinRow:hover .rowActions, -.pinRow:focus-within .rowActions { - opacity: 1; -} -@media (hover: none), (pointer: coarse) { - .rowActions { opacity: 1; } -} -.rowActions .iconButton { - width: 24px; - height: 24px; - color: var(--dsw-alias-label-tertiary); -} -.rowActions .iconButton:hover, -.rowActions .iconButton:focus-visible { - color: var(--dsw-alias-label-primary); -} -.rowActions .iconButton[data-clue-pin='true'], +.pins [data-clue-pin='true'], .pinAccent { color: var(--dsw-alias-state-warn-label, var(--dsw-alias-state-warn-primary, var(--dsw-alias-label-secondary))); } @@ -532,37 +347,6 @@ .workbench > .state { padding: var(--ds-sidebar-gutter); } -.refreshError { - display: flex; - flex-wrap: wrap; - align-items: center; - gap: var(--ds-sidebar-space-2); - margin: 4px 0; - padding: 6px 8px; - border: 1px solid var(--dsw-alias-state-error-primary); - border-radius: var(--ds-sidebar-radius); - color: var(--dsw-alias-label-secondary); - overflow-wrap: anywhere; -} -.emptyState { - display: flex; - flex-direction: column; - align-items: center; - gap: var(--ds-sidebar-space-3); - margin: 12px 0; - padding: 32px 16px; - color: var(--dsw-alias-label-secondary); - text-align: center; -} -.emptyState p { - max-width: 38ch; - margin: 0; - line-height: 20px; - overflow-wrap: anywhere; -} -.emptyIcon { - color: var(--dsw-alias-label-tertiary); -} .resolveHead { display: flex; flex-direction: column; @@ -624,133 +408,29 @@ white-space: normal; overflow-wrap: anywhere; } -.collectForm { - display: flex; - flex: 1; - flex-direction: column; - gap: var(--ds-sidebar-space-2); - min-width: 0; - min-height: 0; -} -.collectForm > .searchBox { - flex: none; -} -.destinationList { - display: flex; - flex: 1 1 112px; - flex-direction: column; - gap: var(--ds-sidebar-space-1); - min-width: 0; - min-height: 36px; - margin: 0; - padding: 0; - border: 0; - overflow: auto; - overscroll-behavior: contain; - scrollbar-width: thin; -} -.destinationRow { - display: flex; - align-items: center; - flex: none; - gap: var(--ds-sidebar-space-2); - min-width: 0; - min-height: 36px; - padding: 4px 8px; - box-sizing: border-box; - border: 0; - background: transparent; - color: var(--dsw-alias-label-primary); - font: inherit; - text-align: start; - width: 100%; - border-radius: var(--ds-sidebar-radius); - cursor: pointer; -} -.destinationRow:disabled { opacity: 0.4; cursor: default; } -.destinationRow:focus-visible { - outline: 2px solid var(--dsw-alias-state-business-primary); - outline-offset: -2px; -} -.destinationRow:hover { - background: var(--dsw-alias-interactive-bg-hover); -} -.destinationRow > span:not([data-clue-artwork]) { - display: -webkit-box; - -webkit-box-orient: vertical; - -webkit-line-clamp: 2; - flex: 1; - min-width: 0; - overflow: hidden; - overflow-wrap: anywhere; -} -.destinationRow > small { - flex: none; - color: var(--dsw-alias-label-tertiary); - font-size: 11px; - font-variant-numeric: tabular-nums; -} -.destinationList:disabled { - opacity: 0.4; -} -.collectFooter { - display: flex; - align-items: center; - flex: none; - gap: var(--ds-sidebar-space-2); - min-width: 0; - justify-content: flex-end; - margin: 0 calc(-1 * var(--ds-sidebar-gutter)) calc(-1 * var(--ds-sidebar-gutter)); - padding: var(--ds-sidebar-space-3) var(--ds-sidebar-gutter); - border-top: 1px solid var(--dsw-alias-border-l1); -} -.collectFooter > button { - flex: none; -} -:global(body[data-ds-dark-theme]) .scopeChoice input, -:global(body[data-ds-dark-theme]) .destinationRow input { +:global(body[data-ds-dark-theme]) .scopeChoice input { color-scheme: dark; } @media (hover: none), (pointer: coarse) { - .rowActions { - opacity: 1; - } .selectionActions > button, .toolButton, .primaryButton, - .stateAction, - .textInput, .scopeChoice, - .destinationRow, .scopeButton, - .searchBox, - .searchBox .searchInput, .selectionReview summary, .querySubmit, .iconButton { min-height: 44px; } - .rowActions .iconButton, .iconButton, .querySubmit { width: 44px; } - .resultRow, - .pinRow { - min-height: 44px; - } - .resultRow { padding-block: 0; } .rowSelection { width: 44px; height: 44px; } .queryRow { min-height: 44px; } - .queryRow .searchBox, .queryRow .iconButton, .queryRow .querySubmit { min-height: 42px; height: 42px; } - .searchBox .searchInput { min-height: 32px; } + .queryRow .iconButton, .queryRow .querySubmit { min-height: 42px; height: 42px; } .queryRow .iconButton, .queryRow .querySubmit { width: 42px; } } -@media (prefers-reduced-motion: reduce) { - .rowActions { - transition: none; - } -} .packRegion > [data-workbench-section] { max-height: 100%; } @@ -783,9 +463,7 @@ min-height: 0; overflow: auto; } -.scopeFields > .field, -.scopeFields > .scopeChoices, -.collectForm > .field { flex: none; } +.scopeFields > .scopeChoices { flex: none; } .scopeTask > .scopeActions { flex: none; flex-wrap: wrap; @@ -795,37 +473,14 @@ border-top: 1px solid var(--dsw-alias-border-l1); } .scopeTask > .scopeActions > :first-child { margin-inline-end: auto; } -.collectionTask { - display: flex; - flex: 1; - flex-direction: column; - gap: var(--ds-sidebar-space-3); - min-width: 0; - min-height: 0; - overflow: hidden; -} -.collectionTask .collectForm { min-height: 0; } -.collectionFields { - display: flex; - flex: 1; - flex-direction: column; - gap: var(--ds-sidebar-space-3); - min-height: 0; - overflow: auto; -} -.collectionFields > .searchBox, -.collectionFields > .field { flex: none; } -.collectionTask .destinationList { flex: none; overflow: visible; } @container clue-tab (min-width: 520px) { .batchBar { display: flex; } .batchBar > .selectionActions { flex: 1; justify-content: flex-end; } } -.scopeTask, -.collectionTask { +.scopeTask { box-sizing: border-box; padding: var(--ds-sidebar-gutter); } -.collectionTask > .scopeHint { margin: 0; } .readiness { display: flex; flex: none; diff --git a/src/client/ui/patterns.module.css b/src/client/ui/patterns.module.css index d54943a7..a6c04fe3 100644 --- a/src/client/ui/patterns.module.css +++ b/src/client/ui/patterns.module.css @@ -163,6 +163,9 @@ opacity: 0; } +/* Muted at rest; the kit's hover/focus rule restores the primary ink. */ +.listRowActions > button { color: var(--dsw-alias-label-tertiary); } + .listRow:hover .listRowActions, .listRow:focus-within .listRowActions, .listRow[data-selected='true'] .listRowActions { diff --git a/src/client/ui/patterns.tsx b/src/client/ui/patterns.tsx index 5cc0fc71..92897fc7 100644 --- a/src/client/ui/patterns.tsx +++ b/src/client/ui/patterns.tsx @@ -26,7 +26,7 @@ * Skin contract: every paint resolves to a `--dsw-*` / `--ds-*` token * (`tests/theme.spec.ts` scans `patterns.module.css`). */ -import type { CSSProperties, ReactNode } from 'react' +import type { CSSProperties, MouseEvent, ReactNode } from 'react' import clsx from 'clsx' import { ActionButton } from './kit.tsx' import css from './patterns.module.css' @@ -134,7 +134,7 @@ export interface ListRowProps extends DataAttributes { readonly selected?: boolean /** A row that exists but is not actionable yet (unresolved reference). */ readonly dimmed?: boolean - readonly onContextMenu?: (event: React.MouseEvent) => void + readonly onContextMenu?: (event: MouseEvent) => void /** * Roving-focus membership for {@link useListNavigation}: the title button * carries `data-list-primary` and is the list's one Tab stop when `true`, @@ -230,8 +230,11 @@ export interface ErrorBlockProps extends DataAttributes { /** A sanitized second line (a reason code, a dependency id) — never a secret. */ readonly detail?: ReactNode readonly retryLabel?: string - readonly onRetry?: () => void - /** A retry already in flight: the button stays, disabled, and says so. */ + readonly onRetry?: (event: MouseEvent) => void + /** + * A retry already in flight: the button stays focusable but inert + * (`aria-disabled`), so keyboard focus is not dropped to the document. + */ readonly busy?: boolean readonly className?: string } @@ -245,7 +248,7 @@ export interface ErrorBlockProps extends DataAttributes { */ export function ErrorBlock({ message, detail, retryLabel, onRetry, busy, className, ...dataProps }: ErrorBlockProps): ReactNode { return ( -
+
{message} {detail !== undefined && {detail}} @@ -254,7 +257,8 @@ export function ErrorBlock({ message, detail, retryLabel, onRetry, busy, classNa {/* The kit's own action recipe: a retry is a button, not a fifth spelling of one. */} - {retryLabel} + { if (busy !== true) onRetry(event) }}>{retryLabel} )}
diff --git a/tests/clues-tab-css.spec.ts b/tests/clues-tab-css.spec.ts index 3a96b37f..4b9f66f8 100644 --- a/tests/clues-tab-css.spec.ts +++ b/tests/clues-tab-css.spec.ts @@ -21,6 +21,7 @@ const controls = read('src/client/ui/controls.module.css') // The pack shelf's rows are the shared ListRow recipe now, so its density and // touch-target contract lives in the shared patterns sheet, not in the tab's. const patterns = read('src/client/ui/patterns.module.css') +const kit = read('src/client/ui/kit.module.css') describe('clue tab container-query layout', () => { it('makes the tab root an inline-size container and never a viewport column', () => { @@ -63,23 +64,18 @@ describe('clue workbench density and affordances', () => { }) it('keeps 30px rows and reveals row actions on hover, focus or touch', () => { - expect(tab).toMatch(/\.resultRow,[\s\S]*?\.pinRow\s*\{[^}]*min-height:\s*30px/) - // A pack row IS a ListRow: 30px, hover/focus-revealed actions, untouched at rest. + // Result, pin and pack rows ARE ListRows: 30px, hover/focus-revealed actions. expect(patterns).toMatch(/\.listRow\s*\{[^}]*min-height:\s*30px/) expect(patterns).toMatch(/\.listRowActions\s*\{[^}]*opacity:\s*0/) expect(patterns).toMatch(/\.listRow:hover \.listRowActions,[\s\S]*?\{\s*opacity:\s*1/) - const actions = /\.rowActions\s*\{([^}]+)\}/.exec(tab)?.[1] - expect(actions).toBeDefined() - expect(actions).toMatch(/opacity:\s*0/) - expect(tab).toMatch(/\.resultRow:hover \.rowActions,[\s\S]*?\{\s*opacity:\s*1/) - expect(tab).toMatch(/@media \(hover: none\), \(pointer: coarse\)[\s\S]*\.rowActions\s*\{\s*opacity:\s*1/) - expect(tab).toMatch(/\.rowActions \.iconButton\s*\{[^}]*width:\s*24px/) + expect(patterns).toMatch(/@media \(pointer: coarse\) \{[^}]*\}\s*\.listRowActions \{ opacity: 1; \}/) + expect(tab).not.toMatch(/\.(resultRow|pinRow|rowActions)\b/) }) it('keeps the touch targets from the older scales where the new rows are smaller', () => { expect(tab).toMatch(/@media[^}]*pointer:\s*coarse/) expect(tab).toContain('min-height: 44px') - expect(tab).toMatch(/@media[^}]*pointer:\s*coarse[\s\S]*\.rowActions \.iconButton,[^}]*width:\s*44px/) + expect(kit).toMatch(/@media \(pointer: coarse\) \{\s*\.iconButton \{ width: 44px; height: 44px; \}/) // The ListRow's own coarse-pointer rule: the pack reference button is a // 44px target through the row, and the row itself grows to 44px. expect(patterns).toMatch(/@media \(pointer: coarse\) \{\s*\.listRow \{ min-height: 44px; \}/) diff --git a/tests/theme.spec.ts b/tests/theme.spec.ts index fb51f488..0662883e 100644 --- a/tests/theme.spec.ts +++ b/tests/theme.spec.ts @@ -198,7 +198,8 @@ describe('skin contract: the plugin owns no color of its own', () => { expect(packRegion).toContain('background: var(--dsw-alias-bg-layer-1)') expect(source).not.toMatch(/box-shadow/) expect(source).toMatch(/\.querySubmit\s*\{[^}]*background:\s*transparent/) - expect(source).toMatch(/\.rowActions \.iconButton\s*\{[^}]*color:\s*var\(--dsw-alias-label-tertiary\)/) + const patterns = readFileSync(resolve(ROOT, 'src/client/ui/patterns.module.css'), 'utf8') + expect(patterns).toMatch(/\.listRowActions > button\s*\{[^}]*color:\s*var\(--dsw-alias-label-tertiary\)/) }) it('source identity remains themed while actions use the single shared recipe', () => { diff --git a/tests/ui-patterns.spec.tsx b/tests/ui-patterns.spec.tsx index af97a4a7..504f0fa2 100644 --- a/tests/ui-patterns.spec.tsx +++ b/tests/ui-patterns.spec.tsx @@ -173,13 +173,17 @@ describe('ErrorBlock', () => { expect(view.container.querySelector('button')).toBeNull() }) - it('locks the retry while one is in flight instead of offering a second', () => { + it('locks the retry while one is in flight without dropping its focus', () => { + const onRetry = vi.fn() view = renderRoot(createElement(ErrorBlock, { - message: 'Request failed', retryLabel: 'Retry', onRetry: () => {}, busy: true, + message: 'Request failed', retryLabel: 'Retry', onRetry, busy: true, })) const retry = view.container.querySelector('button')! - expect(retry.disabled).toBe(true) - expect(retry.getAttribute('aria-busy')).toBe('true') + expect(retry.disabled).toBe(false) + expect(retry.getAttribute('aria-disabled')).toBe('true') + expect(view.container.querySelector('[role="alert"]')!.getAttribute('aria-busy')).toBe('true') + retry.click() + expect(onRetry).not.toHaveBeenCalled() }) it('separates a sanitized detail from the message', () => {