))}
diff --git a/src/client/ui/patterns.module.css b/src/client/ui/patterns.module.css
index a3541bd6..2dbbae1f 100644
--- a/src/client/ui/patterns.module.css
+++ b/src/client/ui/patterns.module.css
@@ -98,21 +98,33 @@
gap: 1px;
}
-/* The title is a real button when the row navigates: keyboard operation and a
- visible focus ring come for free, and the row's own padding stays intact. */
+/* The title text. Truncation lives here, so a caller's locator can land on the
+ element that actually clips — a wrapper would inherit the ellipsis but not
+ the measured overflow. */
+.listRowName {
+ min-width: 0;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+/* A navigating row makes the whole caption (name + subtitle) one button:
+ keyboard operation and a visible focus ring come for free, and the row's own
+ padding stays intact. */
.listRowTitle {
appearance: none;
- display: block;
+ display: flex;
+ flex-direction: column;
+ align-items: stretch;
+ gap: 1px;
min-width: 0;
+ flex: 1 1 auto;
padding: 0;
border: 0;
background: none;
color: inherit;
font: inherit;
text-align: start;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
cursor: pointer;
}
@@ -123,6 +135,7 @@
}
.listRowSubtitle {
+ min-width: 0;
color: var(--dsw-alias-label-tertiary);
font: var(--dsw-font-xxxs-11);
white-space: nowrap;
diff --git a/src/client/ui/patterns.tsx b/src/client/ui/patterns.tsx
index 10ec3396..84211f19 100644
--- a/src/client/ui/patterns.tsx
+++ b/src/client/ui/patterns.tsx
@@ -106,6 +106,18 @@ export interface ListRowProps extends DataAttributes {
/** Glyph or status dot at the leading edge. */
readonly leading?: ReactNode
readonly title: ReactNode
+ /**
+ * `data-*` for the title element itself. The title owns the ellipsis, so a
+ * caller's locator must land on the title, not on a wrapper inside it — a
+ * nested span would inherit the truncation but not the measured style.
+ */
+ readonly titleData?: DataAttributes
+ /**
+ * Accessible name of the title button when the visible title alone would be
+ * ambiguous ("Release clues" → "Manage pack: Release clues"). Ignored for a
+ * plain title, which is text rather than a control.
+ */
+ readonly titleLabel?: string
/** Secondary line under the title (a subtitle, not a second fact column). */
readonly subtitle?: ReactNode
/** Facts at the trailing edge, before the actions. */
@@ -122,9 +134,15 @@ 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
- /** Roving tabindex: only one row of a list is in the tab order. */
- readonly primaryTabIndex?: boolean
+ readonly onContextMenu?: (event: React.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`,
+ * and leaves the tab order when `false`. The hook's contract is exactly
+ * "mark each title with data-list-primary", so the row honours it here
+ * instead of making every caller reach into the button.
+ */
+ readonly primary?: boolean
readonly className?: string
}
@@ -137,8 +155,8 @@ export interface ListRowProps extends DataAttributes {
*/
export function ListRow(props: ListRowProps): ReactNode {
const {
- leading, title, subtitle, meta, actions, titleAs = 'plain', onTitleClick,
- selected, dimmed, onContextMenu, primaryTabIndex, className, ...dataProps
+ leading, title, titleData, titleLabel, subtitle, meta, actions, titleAs = 'plain', onTitleClick,
+ selected, dimmed, onContextMenu, primary, className, ...dataProps
} = props
return (
{leading !== undefined && {leading}}
-
- {titleAs === 'button'
- ? (
-
- )
- : {title}}
- {subtitle !== undefined && {subtitle}}
-
+ {titleAs === 'button'
+ ? (
+ // A navigating row puts the subtitle INSIDE the button: the whole
+ // two-line caption is then one click target and one accessible
+ // name, exactly like the browse rows this replaces.
+
+ )
+ : (
+
+ {title}
+ {subtitle !== undefined && {subtitle}}
+
+ )}
{meta !== undefined && {meta}}
{actions !== undefined && {actions}}
@@ -171,8 +199,10 @@ export function ListRow(props: ListRowProps): ReactNode {
/** A text title must not inherit the button's pointer cursor. */
const TITLE_TEXT = { cursor: 'inherit' } as const
+/** The title text itself: truncation happens here, on whatever owns the row. */
+
/** Props of {@link EmptyState}. */
-export interface EmptyStateProps {
+export interface EmptyStateProps extends DataAttributes {
readonly icon?: ReactNode
readonly title: ReactNode
readonly description?: ReactNode
@@ -183,9 +213,9 @@ export interface EmptyStateProps {
}
/** The one empty state: glyph, one-line title, optional description, actions. */
-export function EmptyState({ icon, title, description, actions, tone = 'well', className }: EmptyStateProps): ReactNode {
+export function EmptyState({ icon, title, description, actions, tone = 'well', className, ...dataProps }: EmptyStateProps): ReactNode {
return (
-
+
{icon !== undefined && {icon}}
{title}
{description !== undefined && {description}}
@@ -195,7 +225,7 @@ export function EmptyState({ icon, title, description, actions, tone = 'well', c
}
/** Props of {@link ErrorBlock}. */
-export interface ErrorBlockProps {
+export interface ErrorBlockProps extends DataAttributes {
readonly message: ReactNode
/** A sanitized second line (a reason code, a dependency id) — never a secret. */
readonly detail?: ReactNode
@@ -213,9 +243,9 @@ export interface ErrorBlockProps {
* belongs to, and the four hand-written spellings this replaces had already
* drifted in exactly that way (two put the button above, two below).
*/
-export function ErrorBlock({ message, detail, retryLabel, onRetry, busy, className }: ErrorBlockProps): ReactNode {
+export function ErrorBlock({ message, detail, retryLabel, onRetry, busy, className, ...dataProps }: ErrorBlockProps): ReactNode {
return (
-
+
{message}
{detail !== undefined && {detail}}
diff --git a/tests/clues-tab-css.spec.ts b/tests/clues-tab-css.spec.ts
index e3f11d21..3a96b37f 100644
--- a/tests/clues-tab-css.spec.ts
+++ b/tests/clues-tab-css.spec.ts
@@ -18,6 +18,9 @@ const sections = read('src/client/ui/workbench-section.module.css')
const switcher = read('src/client/ui/source-switcher.module.css')
const search = read('src/client/ui/search-field.module.css')
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')
describe('clue tab container-query layout', () => {
it('makes the tab root an inline-size container and never a viewport column', () => {
@@ -61,7 +64,10 @@ 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/)
- expect(tab).toMatch(/\.packRow\s*\{[^}]*min-height:\s*30px/)
+ // A pack row IS a ListRow: 30px, hover/focus-revealed actions, untouched at rest.
+ 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/)
@@ -74,7 +80,9 @@ describe('clue workbench density and affordances', () => {
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(tab).toMatch(/@media[^}]*pointer:\s*coarse[\s\S]*\.packReference[^}]*width:\s*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; \}/)
})
it('uses the shared 32px search field with a flat query wrapper', () => {
diff --git a/tests/ui-patterns.spec.tsx b/tests/ui-patterns.spec.tsx
index 22ccf45a..20aa515f 100644
--- a/tests/ui-patterns.spec.tsx
+++ b/tests/ui-patterns.spec.tsx
@@ -97,10 +97,25 @@ describe('ListRow', () => {
expect(onClick).toHaveBeenCalledOnce()
})
- it('keeps the roving tabindex contract: one row in the tab order', () => {
- view = renderRoot(createElement(ListRow, { title: 'First', titleAs: 'button', primaryTabIndex: true }))
- view.rerender(createElement(ListRow, { title: 'First', titleAs: 'button', primaryTabIndex: false }))
- expect(view.container.querySelector('button')!.tabIndex).toBe(-1)
+ it('marks the roving-focus entry on the title button, not on the row shell', () => {
+ // useListNavigation focuses the element carrying data-list-primary, so the
+ // marker and the tab stop must both land on the real button.
+ view = renderRoot(createElement(ListRow, { title: 'First', titleAs: 'button', primary: true }))
+ const entry = view.container.querySelector('button')!
+ expect(entry.hasAttribute('data-list-primary')).toBe(true)
+ expect(entry.tabIndex).toBe(0)
+
+ view.rerender(createElement(ListRow, { title: 'Second', titleAs: 'button', primary: false }))
+ const other = view.container.querySelector('button')!
+ expect(other.hasAttribute('data-list-primary')).toBe(true)
+ expect(other.tabIndex).toBe(-1)
+ })
+
+ it('leaves the tab order alone when the row is not part of a roving list', () => {
+ view = renderRoot(createElement(ListRow, { title: 'Plain', titleAs: 'button' }))
+ const button = view.container.querySelector('button')!
+ expect(button.hasAttribute('data-list-primary')).toBe(false)
+ expect(button.tabIndex).toBe(0)
})
it('mounts every slot it is given and nothing it is not', () => {