Skip to content

Commit 1d1d2d6

Browse files
committed
fix(plugin-detail): the panel header row is one button stretched over the row, not a clickable div
Claude-Session: https://claude.ai/code/session_01Utp6CaA9ZdTcj97mzGtHYt Co-authored-by: Claude <noreply@anthropic.com>
1 parent b8c4395 commit 1d1d2d6

2 files changed

Lines changed: 21 additions & 15 deletions

File tree

‎ui/packages/plugin-detail/src/RelatedList.tsx‎

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2857,23 +2857,19 @@ export const RelatedList: React.FC<RelatedListProps> = ({
28572857
aria-busy={pendingRows > 0 || undefined}
28582858
>
28592859
<div
2860-
className={cn('group/panel-head flex h-9 items-center gap-1.5 px-3 text-[12.5px] font-semibold', open && 'cursor-pointer')}
2860+
className="group/panel-head relative flex h-9 items-center gap-1.5 px-3 text-[12.5px] font-semibold"
28612861
data-related-panel-head=""
2862-
// The row is the target: a click on its free space opens the list
2863-
// too. Its own controls stop their clicks; a click inside the ⋯
2864-
// menu's portaled content bubbles here through React yet lands
2865-
// outside the row in the DOM, and is not the row's.
2866-
onClick={open ? (event) => {
2867-
if (event.currentTarget.contains(event.target as Node)) open();
2868-
} : undefined}
28692862
>
28702863
{open ? (
2864+
// The row is the target: the button's ::after stretches over the
2865+
// whole header, so a click on its free space opens the list too,
2866+
// and the row stays one control. The controls sit above it.
28712867
<button
28722868
type="button"
2873-
className="flex min-w-0 items-center gap-1.5 rounded-sm text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
2869+
className="flex min-w-0 cursor-pointer items-center gap-1.5 rounded-sm text-left after:absolute after:inset-0 after:content-[''] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
28742870
title={viewAll}
28752871
data-related-panel-open=""
2876-
onClick={(e) => { e.stopPropagation(); open(); }}
2872+
onClick={() => open()}
28772873
>
28782874
<span className={cn('min-w-0 truncate', isEmpty && 'text-muted-foreground font-medium')}>{title}</span>
28792875
{countChip}
@@ -2896,7 +2892,7 @@ export const RelatedList: React.FC<RelatedListProps> = ({
28962892
{/* Drawn on hover or focus, and while the ⋯ menu is open: its
28972893
content is portaled, so neither holds there. */}
28982894
<span
2899-
className="ml-auto flex shrink-0 items-center gap-0.5 opacity-0 transition-opacity group-hover/panel-head:opacity-100 group-focus-within/panel-head:opacity-100 has-[[data-state=open]]:opacity-100 [@media(hover:none)]:opacity-100"
2895+
className="relative z-10 ml-auto flex shrink-0 items-center gap-0.5 opacity-0 transition-opacity group-hover/panel-head:opacity-100 group-focus-within/panel-head:opacity-100 has-[[data-state=open]]:opacity-100 [@media(hover:none)]:opacity-100"
29002896
data-related-panel-controls=""
29012897
>
29022898
{cardChrome && <RelatedPanelHandle chrome={cardChrome} title={title} />}

‎ui/packages/plugin-detail/src/__tests__/RelatedPanel.header-27524.test.tsx‎

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
* chrome:
1313
*
1414
* - Target 1: the header is the title, then the count chip; the row (or the
15-
* chip) opens the whole list, and its title says 「查看全部 N 条」; ⠿ + ⋯ sit
15+
* chip) opens the whole list through ONE button stretched over the row,
16+
* and its title says 「查看全部 N 条」; ⠿ + ⋯ sit
1617
* at the RIGHT end, drawn on hover or focus; ⋯ holds 隐藏 alone; no
1718
* collapse, no ⤢; ⌥↑ / ⌥↓ on the focused handle move the panel.
1819
* - Target 11: the compact row's first column skips the foreign key that
@@ -91,10 +92,19 @@ describe('the related panel header (objectstack#27524, Target 1)', () => {
9192
const chrome = chromeOf();
9293
renderPanel(chrome);
9394
await waitFor(() => expect(screen.getByText('Call Ada')).toBeInTheDocument());
94-
fireEvent.click(head());
95-
fireEvent.click(head().querySelector('[data-related-panel-open]')!);
95+
const open = head().querySelector('[data-related-panel-open]') as HTMLButtonElement;
96+
fireEvent.click(open);
9697
fireEvent.click(head().querySelector('[data-related-card-count]')!);
97-
expect(chrome.onEnlarge).toHaveBeenCalledTimes(3);
98+
expect(chrome.onEnlarge).toHaveBeenCalledTimes(2);
99+
// The row is one control, not a clickable div: the button's ::after
100+
// stretches over the positioned header, and the controls sit above it.
101+
expect(open.tagName).toBe('BUTTON');
102+
expect(open.className).toContain('after:absolute');
103+
expect(open.className).toContain('after:inset-0');
104+
expect(head().className).toMatch(/\brelative\b/);
105+
const controls = head().querySelector('[data-related-panel-controls]') as HTMLElement;
106+
expect(controls.className).toMatch(/\brelative\b/);
107+
expect(controls.className).toContain('z-10');
98108
});
99109

100110
it('⠿ + ⋯ sit at the right end, shown on hover or focus; their clicks do not open the list', async () => {

0 commit comments

Comments
 (0)