|
159 | 159 | return out |
160 | 160 | } |
161 | 161 |
|
| 162 | + // True only when the `{:else}` branch below actually renders option rows. `role="listbox"` |
| 163 | + // requires `option` children, so it must NOT be set during the searching / loading / empty |
| 164 | + // states (which replace the rows with a spinner or message) even when `results` still holds a |
| 165 | + // stale set. Gating on `results.length > 0` alone tripped axe's `aria-required-children` when |
| 166 | + // a reopened dialog re-ran (spinner showing, persisted results still in `results`). |
| 167 | + const showingRows = $derived(isIndexAvailable && isIndexReady && !isSearching && results.length > 0) |
| 168 | +
|
162 | 169 | /** Scrolls the cursor row into view. Called by the parent after cursor changes. */ |
163 | 170 | export function scrollCursorIntoView(): void { |
164 | 171 | void tick().then(() => { |
|
185 | 192 | <div |
186 | 193 | class="results-container" |
187 | 194 | bind:this={resultsContainer} |
188 | | - role={results.length > 0 ? 'listbox' : undefined} |
189 | | - aria-label={results.length > 0 ? 'Search results' : undefined} |
| 195 | + role={showingRows ? 'listbox' : undefined} |
| 196 | + aria-label={showingRows ? 'Search results' : undefined} |
190 | 197 | > |
191 | 198 | {#if !isIndexAvailable} |
192 | 199 | <div class="index-unavailable"> |
|
343 | 350 | } |
344 | 351 |
|
345 | 352 | .col-label { |
346 | | - font-size: var(--font-size-sm); |
| 353 | + font-size: var(--font-size-md); |
347 | 354 | color: var(--color-text-tertiary); |
348 | 355 | overflow: hidden; |
349 | 356 | text-overflow: ellipsis; |
|
410 | 417 | margin: 0; |
411 | 418 | padding: 0 0 0 1.25em; |
412 | 419 | color: var(--color-text-tertiary); |
413 | | - font-size: var(--font-size-sm); |
| 420 | + font-size: var(--font-size-md); |
414 | 421 | text-align: left; |
415 | 422 | } |
416 | 423 |
|
|
420 | 427 |
|
421 | 428 | .result-row { |
422 | 429 | /* Vertical padding sits at --spacing-xxs (~4 px) instead of --spacing-xs |
423 | | - (~8 px) so the Path column can use --font-size-sm without growing the row. |
| 430 | + (~8 px) to keep the row compact at the dialog's --font-size-md type. |
424 | 431 | All cells vertically center via the grid's `align-items: center` rule above, |
425 | | - so the look stays clean with the tighter padding. */ |
| 432 | + so the look stays clean with the tighter padding. Rows aren't virtualized |
| 433 | + (search caps at 30, Selection lists one folder), so the height is content- |
| 434 | + driven: no row-height constant to keep in sync with the font. */ |
426 | 435 | padding: var(--spacing-xxs) var(--spacing-lg); |
427 | | - font-size: var(--font-size-sm); |
| 436 | + font-size: var(--font-size-md); |
428 | 437 | color: var(--color-text-primary); |
429 | 438 | } |
430 | 439 |
|
|
436 | 445 | background: var(--color-accent-subtle); |
437 | 446 | } |
438 | 447 |
|
| 448 | + /* Under the cursor the muted columns (path / size / modified) read at full |
| 449 | + `--color-text-primary`: the tertiary / secondary tokens drop below WCAG AA |
| 450 | + on the lightest accent tints of the cursor bg (verified by the contrast |
| 451 | + checker, `scripts/check-a11y-contrast/query_dialog_states.go`). Full-contrast |
| 452 | + text on the active row is also the expected "this row is focused" read. */ |
| 453 | + .result-row.is-under-cursor .result-path, |
| 454 | + .result-row.is-under-cursor .result-size, |
| 455 | + .result-row.is-under-cursor .result-modified { |
| 456 | + color: var(--color-text-primary); |
| 457 | + } |
| 458 | +
|
439 | 459 | .result-icon { |
440 | 460 | display: flex; |
441 | 461 | align-items: center; |
|
499 | 519 | padding: var(--spacing-xs) var(--spacing-lg); |
500 | 520 | background: var(--color-bg-secondary); |
501 | 521 | border-top: 1px solid var(--color-border-subtle); |
502 | | - font-size: var(--font-size-sm); |
| 522 | + font-size: var(--font-size-md); |
503 | 523 | color: var(--color-text-tertiary); |
504 | 524 | flex-shrink: 0; |
505 | 525 | } |
|
522 | 542 |
|
523 | 543 | .unavailable-progress { |
524 | 544 | color: var(--color-text-tertiary); |
525 | | - font-size: var(--font-size-sm); |
| 545 | + font-size: var(--font-size-md); |
526 | 546 | margin: var(--spacing-xs) 0 0; |
527 | 547 | } |
528 | 548 | </style> |
0 commit comments