Skip to content

Commit d1efced

Browse files
committed
fix(ui): ensure command palette click actions fire before close
Made-with: Cursor
1 parent 1c42ab8 commit d1efced

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

flexfoil-ui/src/components/CommandPalette.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,18 +85,18 @@ export function CommandPalette({ open, onClose, onResetLayout }: CommandPaletteP
8585

8686
const executeItem = useCallback(
8787
(item: SearchItem) => {
88-
onClose();
8988
if (item.href) {
89+
onClose();
9090
window.open(item.href, '_blank', 'noopener,noreferrer');
9191
return;
9292
}
9393
if (item.panelId) {
9494
openPanel(item.panelId);
9595
}
9696
if (item.postAction) {
97-
// Small delay so panel opens before mode switch
9897
requestAnimationFrame(() => item.postAction!());
9998
}
99+
requestAnimationFrame(() => onClose());
100100
},
101101
[onClose, openPanel],
102102
);
@@ -245,6 +245,7 @@ export function CommandPalette({ open, onClose, onResetLayout }: CommandPaletteP
245245
cursor: 'pointer',
246246
textAlign: 'left',
247247
transition: 'background 0.08s ease',
248+
position: 'relative',
248249
}}
249250
>
250251
{/* Category badge */}
@@ -261,13 +262,14 @@ export function CommandPalette({ open, onClose, onResetLayout }: CommandPaletteP
261262
background: `color-mix(in srgb, ${CATEGORY_COLORS[item.category]} 15%, transparent)`,
262263
color: CATEGORY_COLORS[item.category],
263264
border: `1px solid color-mix(in srgb, ${CATEGORY_COLORS[item.category]} 25%, transparent)`,
265+
pointerEvents: 'none' as const,
264266
}}
265267
>
266268
{CATEGORY_LABELS[item.category]}
267269
</span>
268270

269271
{/* Label + description */}
270-
<div style={{ flex: 1, minWidth: 0 }}>
272+
<div style={{ flex: 1, minWidth: 0, pointerEvents: 'none' as const }}>
271273
<div style={{ fontSize: 13, fontWeight: 500 }}>{item.label}</div>
272274
<div
273275
style={{
@@ -294,6 +296,7 @@ export function CommandPalette({ open, onClose, onResetLayout }: CommandPaletteP
294296
border: '1px solid var(--border-color)',
295297
borderRadius: 3,
296298
color: 'var(--text-muted)',
299+
pointerEvents: 'none' as const,
297300
}}
298301
>
299302
{item.shortcut}

flexfoil-ui/src/contexts/LayoutContext.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,13 @@ export function LayoutProvider({ children, model, panels }: LayoutProviderProps)
4646
findTab(root);
4747

4848
if (existingTabId) {
49-
// Select the existing tab
5049
try {
5150
model.doAction(Actions.selectTab(existingTabId));
5251
setActivePanel(panelId as any);
5352
} catch (e) {
5453
console.warn('Failed to select tab:', e);
5554
}
5655
} else {
57-
// Add a new tab
5856
const tabsets: any[] = [];
5957
const findTabsets = (node: any) => {
6058
if (node.getType?.() === 'tabset') {

0 commit comments

Comments
 (0)