fix(editor): say when a pinned tile is outside the search

A shown tile the search misses carries « Ne correspond pas à la
recherche » under its header (aria-describedby). The no-result notice
now needs no shown tile at all. Flip test watchers are stopped in
afterEach, so a failing assertion never leaves the setters patched.
This commit is contained in:
bchanot committed 2026-11-13 13:49:46 +01:00
1 parent c8109af719
commit b1fd8962ff
9 files changed
+148 -2

No files matched your search

@@ -48,6 +48,8 @@ export interface TileProps {
readOnly: boolean
/** ↑ / ↓ only while neither the search nor a sort narrows or reorders the list. */
movable: boolean
/** The tab's pinned tile the current search misses: it says so under its header. */
outsideSearch?: boolean
on: TileHandlers
}
@@ -93,6 +95,7 @@ function TileHeader({
data-tile-header
aria-expanded={open || editing}
aria-controls={`${base}-body`}
aria-describedby={props.outsideSearch ? `${base}-outside` : undefined}
onClick={onToggle}
className={`grid min-h-11 w-full grid-cols-[1.25rem_1fr] items-start gap-x-3 gap-y-1 rounded-lg p-3 text-left ${META_COLUMN[props.host]} ${BUTTON_RING}`}
>
@@ -296,6 +299,14 @@ export default function ReferenceTile(props: TileProps) {
headerRef={headerRef}
onToggle={toggle}
/>
{props.outsideSearch && (
<p
id={`${base}-outside`}
className="px-3 pb-2 text-xs text-[var(--color-ink-muted)]"
>
{t('editor.references.outside_search')}
</p>
)}
{(open || editing) && (
<div
id={`${base}-body`}
@@ -1,5 +1,6 @@
import type { Reference } from '@faunosteo/core-wasm/types'
import { targetOfKey, type EditorTarget } from '@/editor/navigation'
import { referenceMatches } from '@/editor/references/filter'
import type { CiterItem } from '@/editor/references/citations'
import { useEditCommand } from '@/editor/useEditCommand'
import ReferenceTile from './ReferenceTile'
@@ -13,6 +14,8 @@ interface Props {
keys: readonly string[]
citers: ReadonlyMap<string, readonly CiterItem[]>
tiles: ReturnType<typeof useTileState>
/** The current search: a tile it misses (a pinned one) says so. */
query: string
readOnly: boolean
movable: boolean
navigate: (target: EditorTarget) => void
@@ -49,6 +52,7 @@ export default function ReferenceTiles(props: Props) {
editing={!props.readOnly && tiles.editingKey === key}
readOnly={props.readOnly}
movable={props.movable}
outsideSearch={!referenceMatches(reference, props.query)}
on={{
toggle: () => tiles.toggle(key, props.readOnly),
edit: () => props.onEdit(position),
@@ -59,7 +59,7 @@ function Library({ readOnly, navigate, focus, resetSignal }: Props) {
{lib.loaded && (
<>
{all.length === 0 && <EmptyLine />}
{all.length > 0 && shown.matchCount === 0 && (
{all.length > 0 && shown.positions.length === 0 && (
<NoResult query={shown.view.query} onClear={act.clearSearch} />
)}
{!readOnly && !sheetView && shown.positions.length > 0 && (
@@ -73,6 +73,7 @@ function Library({ readOnly, navigate, focus, resetSignal }: Props) {
keys={lib.keys}
citers={lib.citers}
tiles={lib.tiles}
query={shown.view.query}
readOnly={readOnly}
movable={sheetView}
navigate={navigate}