Skip to content

Commit b8c4395

Browse files
committed
fix(plugin-detail): a panel's controls stay drawn while its menu is open
Claude-Session: https://claude.ai/code/session_01Utp6CaA9ZdTcj97mzGtHYt Co-authored-by: Claude <noreply@anthropic.com>
1 parent fbf43d1 commit b8c4395

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2893,8 +2893,10 @@ export const RelatedList: React.FC<RelatedListProps> = ({
28932893
{t('detail.relatedCardNew', { defaultValue: 'New' })}
28942894
</Badge>
28952895
)}
2896+
{/* Drawn on hover or focus, and while the ⋯ menu is open: its
2897+
content is portaled, so neither holds there. */}
28962898
<span
2897-
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 [@media(hover:none)]:opacity-100"
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"
28982900
data-related-panel-controls=""
28992901
>
29002902
{cardChrome && <RelatedPanelHandle chrome={cardChrome} title={title} />}

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,11 @@ describe('the related panel header (objectstack#27524, Target 1)', () => {
125125
await user.click(head().querySelector('[data-related-card-menu]')!);
126126
const items = await screen.findAllByRole('menuitem');
127127
expect(items.map((item) => item.textContent)).toEqual(['Hide']);
128+
// The menu's content is portaled: the controls stay drawn while it is open.
129+
expect(head().querySelector('[data-related-card-menu]')?.getAttribute('data-state')).toBe('open');
130+
expect((head().querySelector('[data-related-panel-controls]') as HTMLElement).className).toContain(
131+
'has-[[data-state=open]]:opacity-100',
132+
);
128133
await user.click(items[0]);
129134
expect(chrome.onHide).toHaveBeenCalledTimes(1);
130135
expect(chrome.onEnlarge).not.toHaveBeenCalled();

0 commit comments

Comments
 (0)