Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
9945fd9
feat: migrate to Solid 2 and Kobalte alpha.5
riccardoperra Nov 20, 2026
460f554
fix: cover nested overlay and keyboard regressions
riccardoperra Nov 20, 2026
aacf4a5
ci: publish installable package previews for pull requests
riccardoperra Nov 21, 2026
6fdfdac
docs: use npm to install the preview tarballs together
riccardoperra Nov 21, 2026
a95b146
fix: post package preview links and register tooltip layers
riccardoperra Nov 21, 2026
dd0b950
fix: restore popup motion and keep focus scrolling local
riccardoperra Nov 22, 2026
16af946
fix: use npm in package preview install instructions
riccardoperra Nov 22, 2026
7e92e53
fix(dropdown-menu): reset separator borders and tighten spacing
riccardoperra Nov 24, 2026
740c137
docs(changeset): record dropdown menu fix
riccardoperra Nov 24, 2026
18727d2
fix(styles): make dialog titles inherit header typography
riccardoperra Nov 24, 2026
da93b79
Merge pull request #144 from riccardoperra/fix/dropdown-menu-density-…
riccardoperra Nov 24, 2026
be7227c
feat(styles): add hover card surface and resizable handle styles
riccardoperra Nov 24, 2026
507e164
fix(styles): keep the resizable handle out of the panel layout
riccardoperra Nov 24, 2026
905bed0
feat(kit): add HoverCard and Resizable
riccardoperra Nov 24, 2026
25055b0
test(storybook): add HoverCard and Resizable stories and journeys
riccardoperra Nov 24, 2026
addbdbf
docs(changeset): record HoverCard and Resizable
riccardoperra Nov 24, 2026
ecb581e
fix(styles): show the resizable handle focus line without a transition
riccardoperra Nov 24, 2026
b8c2589
docs(kit): document HoverCard and Resizable
riccardoperra Nov 24, 2026
0ee112b
Merge pull request #145 from riccardoperra/feat/sidebar-subagent-prov…
riccardoperra Nov 24, 2026
6658258
fix(select): remove default list padding from dropdown listbox
riccardoperra Nov 25, 2026
b3d2cb5
Merge remote-tracking branch 'origin/main' into HEAD
riccardoperra Nov 25, 2026
e37e878
docs(design): add CodeLoom review rules to Inkstone
riccardoperra Nov 27, 2026
f377a3b
feat(kit): add Avatar and align HoverCard with Inkstone
riccardoperra Nov 27, 2026
69c8b82
docs(kit): document Avatar and the HoverCard list, drop Proposed
riccardoperra Nov 27, 2026
53ff00c
Merge pull request #148 from riccardoperra/feat/kit-avatar-hovercard
riccardoperra Nov 27, 2026
6da2ca3
feat(kit): add TooltipProvider for app-wide tooltip defaults
riccardoperra Nov 28, 2026
e3dea1e
docs(kit): add TooltipProvider exports to the docs manifest
riccardoperra Nov 28, 2026
67ed854
feat(kit): calmer tooltip defaults
riccardoperra Nov 28, 2026
5681365
chore(kit): update public API snapshot for TooltipProvider
riccardoperra Nov 28, 2026
0c36758
test(kit): hover with a synthetic pointer event in the provider test
riccardoperra Nov 28, 2026
8b51ddd
Merge pull request #149 from riccardoperra/feat/tooltip-defaults
riccardoperra Nov 28, 2026
61317d0
feat(kit): share one hover card and move it between triggers
riccardoperra Nov 28, 2026
f5c9498
docs(hover-card): keep demo links at their own width so the card sits…
riccardoperra Nov 28, 2026
a534066
feat(kit): nested hover cards and a dotted underline on text triggers
riccardoperra Nov 28, 2026
5bd7447
Merge pull request #150 from riccardoperra/feat/hovercard-shared-host
riccardoperra Nov 28, 2026
ec9472f
fix(kit): put HoverCardContent attributes and handlers on the card
riccardoperra Nov 28, 2026
d5a3631
Merge pull request #151 from riccardoperra/fix/hovercard-content-on-card
riccardoperra Nov 28, 2026
f225914
fix(tooltip): don't open an empty bubble when content is missing
riccardoperra Nov 28, 2026
57722e1
Merge pull request #153 from riccardoperra/fix/tooltip-empty-content-…
riccardoperra Nov 28, 2026
6d52312
fix(hover-card): don't open an empty card
riccardoperra Nov 28, 2026
f8305a1
Merge pull request #154 from riccardoperra/fix/hovercard-controlled-c…
riccardoperra Nov 28, 2026
3c6e9b1
chore: upgrade to stable Kobalte 2.0
riccardoperra Nov 28, 2026
1b75eed
Merge main into the Solid 2 migration branch
riccardoperra Nov 28, 2026
b41e5f7
fix(select): type the listbox ref before mount
riccardoperra Nov 28, 2026
c392b38
fix(hover-card): wait for pointer motion before opening
riccardoperra Nov 28, 2026
4c1372b
fix(tooltip): ignore stationary pointer entry
riccardoperra Nov 28, 2026
d60985d
fix(dialog): keep focus inside nested portals
riccardoperra Nov 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 5 additions & 0 deletions .changeset/design-guide-from-sessions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@codeui/kit": patch
---

Extend the Inkstone guide with rules from CodeLoom reviews: a 6px gap between islands, hover cards instead of `title`, rows in a list, background work, technical values, avatars, forms, and loading without an empty flash.
5 changes: 5 additions & 0 deletions .changeset/dropdown-menu-spacing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@codeui/styles": patch
---

Draw dropdown separators as a single line aligned with the item labels. Reduce row padding and the gaps between items and before shortcuts.
9 changes: 9 additions & 0 deletions .changeset/hover-card-resizable.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@codeui/kit": minor
"@codeui/styles": minor
---

Add HoverCard (`@codeui/kit/hover-card`) and Resizable (`@codeui/kit/resizable`), with their styles in `@codeui/styles/hovercard` and `@codeui/styles/resizable`.

- `HoverCard`, `HoverCardTrigger` and `HoverCardContent` show supplementary details on hover or keyboard focus. The card opens after 500ms, closes 150ms after the pointer leaves, closes on Escape, uses the Popover surface with a 320px max width, and does not animate when opened from the keyboard.
- `Resizable`, `ResizablePanel` and `ResizableHandle` split a row or a column into panels sized by fractions or `"240px"` strings, with `minSize`, `maxSize` and `collapsible`. The handle is an 8px hit area with a 1px line that changes colour on hover, drag and focus, and it moves with the arrow keys, Home and End.
14 changes: 14 additions & 0 deletions .changeset/hover-card-shared-surface.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
"@codeui/kit": minor
"@codeui/styles": minor
---

Hover cards share one card and move it between triggers.

- All the hover cards of a page share one card. Moving the pointer or keyboard focus to another trigger while a card is open moves that card at once: it slides to the new trigger, resizes to the new content, and fades the new content in. For 400ms after a card closes, the next one opens at once and without the pop. The move lasts 200ms (`--cui-motion-duration-panel`) with the kit's ease-out. While the pointer is on its way to the open card, another trigger it crosses takes the card only after 150ms of rest. A move from the keyboard swaps the content in place with no motion; with reduced motion only the new content fades in.
- `HoverCardGroup` gives the cards inside it a card of their own, with `skipDelayDuration` for the skip window. `shared={false}` gives one `HoverCard` its own surface; `forceMount` implies it.
- `HoverCardContent` is no longer polymorphic. Its props (`class`, `classes`, `style`, `ref`, `mount`, dismiss handlers, and any other attribute or event handler) go on the shared card while that card shows it, and come off when another card takes it over.
- `HoverCard` drops the Kobalte root options it never used (`id`). The trigger renders without a Kobalte popover anchor and still sets `data-expanded` and `data-closed`.
- Overlays opened by hover tell pointer from keyboard more reliably: the input tracker also records `pointerover`, which the browser fires before the `pointermove` that crosses into an element.
- A hover card opened from inside another card's content gets a surface of its own. The outer card stays open while the pointer is on the inner card and until it closes, and a press on the inner card does not close it.
- An `a` trigger (alone or `as={Link}`) has a dotted underline in the hint tone (`--cui-hovercard-trigger-decoration-color`) that takes the text colour on hover and while the card is open.
5 changes: 5 additions & 0 deletions .changeset/hovercard-controlled-closed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@codeui/kit": patch
---

HoverCard no longer opens an empty card. With `open={false}` a second hover, focus or click left the shared surface open with nothing in it, and a card without `HoverCardContent` opened an empty surface too. Both now stay closed.
10 changes: 10 additions & 0 deletions .changeset/kit-avatar-hovercard.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"@codeui/kit": minor
"@codeui/styles": minor
---

Add Avatar (`@codeui/kit/avatar`, styles in `@codeui/styles/avatar`) and bring HoverCard in line with the Inkstone guide.

- `Avatar` shows a person's picture, or one or two initials on a fill whose hue comes from a stable `identifier` (never the name). It has a full radius with a neutral 20% ring, sizes `xs` to `lg` from the shared control scale and density, the name as its accessible name and in the kit Tooltip, and a dashed `unassigned` state. `avatarHue` and `avatarInitials` are exported.
- `HoverCard` opens at once on click as well as on hover and focus. On a touch screen the first tap on a link opens the card instead of following it. The default placement is `right-start` (it was `bottom`), and the card wraps long words.
- `HoverCardList` and `HoverCardItem` render a list inside a hover card: one line per entry with a state icon, an identifier and a truncated title, nesting by `depth`, capped at 24rem with its own scroll.
8 changes: 8 additions & 0 deletions .changeset/solid-2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@codeui/kit": minor
"@codeui/styles": patch
---

Require Solid 2 and `@solidjs/web` for the component kit. Upgrade the application to Solid 2 and switch to `@solidjs/vite-plugin` before installing this release. The kit uses Kobalte 2.0.0.

Keep the background from receiving pointer input while a hydrated modal is open.
7 changes: 7 additions & 0 deletions .changeset/tooltip-provider-defaults.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@codeui/kit": minor
---

Add `TooltipProvider` (`Provider` in `@codeui/kit/tooltip/parts`) to set `openDelay`, `closeDelay`, `skipDelayDuration`, `gutter`, `shift` and `variant` for every tooltip below it. A prop on one tooltip still wins.

Tooltips are calmer by default: they open 700ms after hover (was 200ms), the next one opens at once for 400ms after one closes (was 300ms), and they use the neutral `secondary` fill (was the brand `primary`). Pass `openDelay`, `skipDelayDuration` or `variant` to keep the old behaviour.
5 changes: 3 additions & 2 deletions .claude/skills/verify-codeui/features/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ Each feature file has an H1, one paragraph of user-visible behavior, and exactly

## Features

- [Overlays](./overlays.md): Dialog and Popover open, focus, dismiss and focus return. Proven journey: `journeys/dialog-keyboard.mjs`.
- [Overlays](./overlays.md): Dialog, Popover and HoverCard open, focus, dismiss and focus return; HoverCard tap, placement and list. Proven journeys: `journeys/dialog-keyboard.mjs`, `journeys/hovercard-touch.mjs`, `journeys/hovercard-list.mjs`, `journeys/hovercard-edge.mjs`.
- [Avatar](./avatar.md): initials contrast on every hue, hue from the id, ring, sizes per density, unassigned, tooltip. Journeys: `journeys/avatar.mjs`, `journeys/avatar-sizes.mjs`.
- [Form fields](./form-fields.md): TextField, Select, Listbox, NumberField, SegmentedControl, RadioList, Checkbox input by keyboard, validation states.
- [Theming](./theming.md): `data-cui-theme` modes, `--cui-*` tokens, and the `@layer cui` override contract.
- [Settings rows](./settings.md): SettingsRow and SettingsGroup labelling, CodeImage parity and phone stacking. Journey: `journeys/settings-row.mjs`.
- [Feedback](./feedback.md): Tooltip on hover and focus. Keyboard journey: `journeys/tooltip-keyboard.mjs`.
- [Sidebar and settings controls](./controls.md): Accordion first click, Switch pointer vs keyboard focus, OptionCard keyboard. Journeys: `journeys/accordion-first-click.mjs`, `journeys/switch-focus.mjs`, `journeys/option-card-keyboard.mjs`.
- [Sidebar and settings controls](./controls.md): Accordion first click, Switch pointer vs keyboard focus, OptionCard keyboard. Resizable handle keyboard. Journeys: `journeys/accordion-first-click.mjs`, `journeys/resizable-keyboard.mjs`, `journeys/switch-focus.mjs`, `journeys/option-card-keyboard.mjs`.
29 changes: 29 additions & 0 deletions .claude/skills/verify-codeui/features/avatar.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Avatar

A person shows as a circle: their picture, or one or two initials on a hue derived from a stable id. The name is the accessible name (`role="img"`) and shows in the kit Tooltip on hover. Sizes follow the shared control scale and density; an unassigned owner is a dashed empty circle.

## Sub-features

- `avatar-initials`: initials reach 4.5:1 against the fill on every hue in both themes; hues differ by id, and the same name with different ids gets different hues; neutral fill without an id.
- `avatar-ring`: full radius and a 1px inset ring at 20% of `--cui-text-default` (§2.5 neutral, 16–35% alpha).
- `avatar-sizes`: `xs`, `sm`, `md`, `lg` equal `--cui-control-height-*` at compact, comfortable and touch density.
- `avatar-unassigned`: dashed border in `--cui-text-muted`, no fill, no children, named "Unassigned".
- `avatar-picture`: the picture covers the circle; a failed picture falls back to initials (`designsystem-avatar--states`).
- `avatar-tooltip`: hovering shows the name in `[data-cui=tooltip-content]`.

## How to get to it (user POV)

- `designsystem-avatar--initials`: eight people, three "Sam Lee" with different ids, one guest without an id.
- `designsystem-avatar--sizes`: every size at compact, comfortable and touch density, with initials, picture and unassigned.
- `designsystem-avatar--states`: picture, failed picture, unassigned.

## Driving it with drive.mjs

- `node .claude/skills/verify-codeui/scripts/drive.mjs designsystem-avatar--initials --journey .claude/skills/verify-codeui/journeys/avatar.mjs` checks contrast per avatar by painting the computed fill into a canvas (Chrome reports OKLCH), hue difference, the ring alpha, and the tooltip on hover.
- `node .claude/skills/verify-codeui/scripts/drive.mjs designsystem-avatar--sizes --journey .claude/skills/verify-codeui/journeys/avatar-sizes.mjs` checks heights against the size table, the unassigned border, and that the picture covers the circle.

## Gotchas

- `getComputedStyle().backgroundColor` returns `oklch(...)`; convert through a canvas before computing contrast.
- The avatar is not focusable, so its tooltip opens on hover only. Keyboard users get the name from the accessible name.
- The failed-picture state needs a request that 404s; the static Storybook server answers `/missing-avatar.png` with 404.
1 change: 1 addition & 0 deletions .claude/skills/verify-codeui/features/controls.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ The controls CodeImage's sidebar and Settings dialog are built from: the accordi
- `switch-pointer` toggles on click with no focus ring.
- `switch-keyboard` toggles with Space and shows the 2px ring; Tab focus shows it too.
- `option-card-keyboard` enters the group with Tab, selects with arrows, draws one ring outside the focused card and the inset accent ring on the selected one.
- `resizable-keyboard` focuses the `separator` handle with Tab, moves it with the arrow keys and stops at the panel's `minSize`/`maxSize` (Home 200px, End 360px). Journey: `journeys/resizable-keyboard.mjs` on `designsystem-resizable--sidebar`; `--vertical` and `--collapsible` render-only.

## How to get to it (user POV)

Expand Down
4 changes: 4 additions & 0 deletions .claude/skills/verify-codeui/features/overlays.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ Dialog and Popover open from a trigger, move focus inside, trap Tab while modal,
- `popover-dismiss` closes on Escape and returns focus to the trigger.
- `popover-pop` opens with `data-motion="none"` from the keyboard and pops from the trigger side with a pointer; surface `--cui-surface-dialog`, radius 18, 14px / 1.3 text. Journey: `journeys/popover-pop.mjs` on `designsystem-popover--popover-story`.
- `menu-pop` the same for DropdownMenu, with 36px rows at 14px. Journey: `journeys/menu-pop.mjs` on `designsystem-dropdownmenu--dropdown-menu-story`.
- `hovercard-open` opens `[data-cui=hovercard-content]` on trigger focus (no motion, focus stays on the trigger) and on a resting pointer; Escape and moving away close it; surface `--cui-surface-dialog`, radius 16, max width 320. Journey: `journeys/hovercard-open.mjs` on `designsystem-hovercard--hover-card-story`.
- `hovercard-touch` opens the card on a touch tap without following the link, places it on the right of the trigger by default, keeps the floating surface (dialog fill, shadow with the dark inset ring, radius 16, max width 320), closes on an outside press, and opens at once on a mouse click. Journey: `journeys/hovercard-touch.mjs` on `designsystem-hovercard--hover-card-story`.
- `hovercard-edge` flips the card to the left when there is no room on the right. Journey: `journeys/hovercard-edge.mjs` on `designsystem-hovercard--edge-placement`.
- `hovercard-list` renders `HoverCardList`: one 28px line per entry, 16px indent per depth, truncated titles, named state icons, capped at 24rem with its own scroll. Journey: `journeys/hovercard-list.mjs` on `designsystem-hovercard--task-list`.
- `popover-parts` composes `@codeui/kit/popover/parts` parts with title, description, arrow and close button.

## How to get to it (user POV)
Expand Down
57 changes: 57 additions & 0 deletions .claude/skills/verify-codeui/journeys/avatar-sizes.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// Avatar sizes follow the shared control height scale and density; unassigned is a dashed empty circle.
export default async ({ page, check }) => {
await check("sizes match the control scale per density", () =>
page.locator("[data-cui-density]").evaluateAll(groups =>
(() => {
const expected = {
compact: [24, 32, 38, 46],
comfortable: [28, 36, 44, 52],
touch: [32, 40, 50, 58],
};
const actual = Object.fromEntries(
groups.map(g => [
g.getAttribute("data-cui-density"),
[...g.querySelectorAll("[data-cui=avatar]:not([data-unassigned])")]
.filter((_, i) => i % 2 === 0)
.map(a => a.getBoundingClientRect().height),
]),
);
return {
pass: JSON.stringify(actual) === JSON.stringify(expected),
actual,
expected,
};
})(),
),
);
await check("unassigned is a dashed empty circle in secondary text colour", () =>
page
.locator("[data-cui=avatar][data-unassigned]")
.first()
.evaluate(a => {
const c = getComputedStyle(a);
return {
pass:
c.borderTopStyle === "dashed" &&
a.childElementCount === 0 &&
c.backgroundColor === "rgba(0, 0, 0, 0)" &&
a.getAttribute("aria-label") === "Unassigned",
border: c.borderTopStyle,
color: c.borderTopColor,
};
}),
);
await check("the picture covers the circle and keeps the ring", () =>
page
.locator("[data-cui=avatar-image]")
.first()
.evaluate(img => ({
pass:
img.complete &&
img.naturalWidth > 0 &&
img.getBoundingClientRect().width ===
img.parentElement.getBoundingClientRect().width,
natural: img.naturalWidth,
})),
);
};
81 changes: 81 additions & 0 deletions .claude/skills/verify-codeui/journeys/avatar.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
// Avatar: initials reach 4.5:1 on their hue in both themes, the ring is a neutral
// 16-35% line, sizes follow the control scale, hover shows the name in the kit Tooltip.
export default async ({ page, step, check, axe }) => {
const contrast = () =>
page.locator("[data-cui=avatar]").evaluateAll(avatars => {
const canvas = document.createElement("canvas");
canvas.width = canvas.height = 1;
const ctx = canvas.getContext("2d", { willReadFrequently: true });
const rgb = color => {
ctx.clearRect(0, 0, 1, 1);
ctx.fillStyle = color;
ctx.fillRect(0, 0, 1, 1);
return [...ctx.getImageData(0, 0, 1, 1).data].slice(0, 3);
};
const lum = ([r, g, b]) =>
[r, g, b]
.map(v => v / 255)
.map(v => (v <= 0.04045 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4))
.reduce((sum, v, i) => sum + v * [0.2126, 0.7152, 0.0722][i], 0);
const ratio = (a, b) => {
const [hi, lo] = [lum(a), lum(b)].sort((x, y) => y - x);
return (hi + 0.05) / (lo + 0.05);
};
return avatars
.filter(
a =>
a.querySelector("[data-cui=avatar-fallback]") &&
!a.hasAttribute("data-unassigned"),
)
.map(a => {
const c = getComputedStyle(a);
return {
name: a.getAttribute("aria-label"),
ratio: Math.round(ratio(rgb(c.backgroundColor), rgb(c.color)) * 100) / 100,
ring: getComputedStyle(a, "::after").boxShadow,
radius: c.borderRadius,
};
});
});
const rows = await contrast();
await check("initials reach 4.5:1 on every hue", () => ({
pass: rows.length > 0 && rows.every(r => r.ratio >= 4.5),
min: Math.min(...rows.map(r => r.ratio)),
rows,
}));
await check("hues differ by id, and the same name with different ids differs", () =>
page.locator("[data-cui=avatar]").evaluateAll(avatars => {
const fills = avatars.map(a => getComputedStyle(a).backgroundColor);
const sam = avatars
.filter(a => a.getAttribute("aria-label") === "Sam Lee")
.map(a => getComputedStyle(a).backgroundColor);
return {
pass: new Set(fills.slice(0, 8)).size === 8 && new Set(sam).size === 3,
sam,
};
}),
);
await check("full radius and a neutral ring at 20% alpha", () => {
const ring = rows[0].ring;
const alpha = Number(/(?:\/\s*|,\s*)([\d.]+)\)/.exec(ring)?.[1]);
return {
pass:
rows.every(r => r.radius === "9999px" || parseFloat(r.radius) >= 9999) &&
/inset/.test(ring) &&
alpha >= 0.16 &&
alpha <= 0.35,
ring,
alpha,
radius: rows[0].radius,
};
});
await step("Hover Ada Lovelace", async () => {
await page.getByRole("img", { name: "Ada Lovelace" }).hover();
await page.locator("[data-cui=tooltip-content]").waitFor({ timeout: 2000 });
});
await check("the tooltip shows the name", async () => {
const text = await page.locator("[data-cui=tooltip-content]").innerText();
return { pass: text.trim() === "Ada Lovelace", text };
});
await axe("tooltip");
};
14 changes: 14 additions & 0 deletions .claude/skills/verify-codeui/journeys/hovercard-edge.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// With no room on the right, the card flips to the left of the trigger.
export default async ({ page, step, check }) => {
const content = page.locator("[data-cui=hovercard-content]");
const trigger = page.locator("[data-cui=hovercard-trigger]");
await step("Tab to the trigger", async () => {
await page.keyboard.press("Tab");
await content.waitFor({ timeout: 2000 });
});
await check("the card sits on the left of the trigger", async () => {
const t = await trigger.boundingBox();
const c = await content.boundingBox();
return { pass: c.x + c.width <= t.x, cardRight: c.x + c.width, triggerLeft: t.x };
});
};
74 changes: 74 additions & 0 deletions .claude/skills/verify-codeui/journeys/hovercard-list.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// A list in a hover card: one line per entry, nesting by indent, truncated titles,
// capped near 24rem with its own scroll.
export default async ({ page, step, check, axe }) => {
const content = page.locator("[data-cui=hovercard-content]");
await step("Tab to the trigger", async () => {
await page.keyboard.press("Tab");
await content.waitFor({ timeout: 2000 });
});
await check("the list caps at 24rem and scrolls on its own", () =>
page.locator("[data-cui=hovercard-list]").evaluate(el => ({
pass:
el.clientHeight <= 384 &&
el.clientHeight > 300 &&
el.scrollHeight > el.clientHeight &&
getComputedStyle(el).overflowY === "auto",
clientHeight: el.clientHeight,
scrollHeight: el.scrollHeight,
})),
);
await check("every entry is one line: icon, identifier, truncated title", () =>
page.locator("[data-cui=hovercard-item]").evaluateAll(items => {
const heights = [
...new Set(items.map(item => Math.round(item.getBoundingClientRect().height))),
];
const title = items[2].querySelector("[data-cui=hovercard-item-title]");
return {
pass:
heights.length === 1 &&
heights[0] <= 32 &&
title.scrollWidth > title.clientWidth &&
getComputedStyle(title).textOverflow === "ellipsis" &&
items.every(
item =>
item.querySelector("[data-cui=hovercard-item-icon]") &&
item.querySelector("[data-cui=hovercard-item-id]"),
),
heights,
truncated: title.scrollWidth > title.clientWidth,
};
}),
);
await check("nesting is shown by indent, 16px per level", () =>
page.locator("[data-cui=hovercard-item]").evaluateAll(items => {
const left = i =>
items[i].querySelector("[data-cui=hovercard-item-icon]").getBoundingClientRect()
.left;
return {
pass: left(1) - left(0) === 16 && left(3) - left(0) === 32,
d1: left(1) - left(0),
d2: left(3) - left(0),
};
}),
);
await check("state icons are named", async () => {
const names = await page.getByRole("img", { name: "Running" }).count();
return { pass: names > 0, running: names };
});
await step("Scroll the list to the end", async () => {
await page
.locator("[data-cui=hovercard-list]")
.evaluate(el => el.scrollTo(0, el.scrollHeight));
});
await check(
"the card stays open and the same size while the list scrolls",
async () => {
const box = await content.boundingBox();
return {
pass: (await content.count()) === 1 && box.height < 480,
height: box.height,
};
},
);
await axe("open");
};
Loading
Loading