Skip to content

Commit b9bfac1

Browse files
author
waleed
committed
ack PR comments
1 parent 552194a commit b9bfac1

File tree

2 files changed

+8
-8
lines changed
  • apps/sim
    • app/workspace/[workspaceId]/w/[workflowId]/components/panel-new/components/editor/components/sub-block/components/tag-dropdown/components
    • components/emcn/components/popover

2 files changed

+8
-8
lines changed

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel-new/components/editor/components/sub-block/components/tag-dropdown/components/keyboard-navigation-handler.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export const KeyboardNavigationHandler: React.FC<KeyboardNavigationHandlerProps>
9595
useEffect(() => {
9696
if (!visible || !flatTagList.length) return
9797

98-
// Helper to open a folder with proper selection callback and child selection
98+
// Helper to open a folder with proper selection callback and parent selection
9999
const openFolderWithSelection = (
100100
folderId: string,
101101
folderTitle: string,
@@ -104,20 +104,20 @@ export const KeyboardNavigationHandler: React.FC<KeyboardNavigationHandlerProps>
104104
) => {
105105
const selectionCallback = () => handleTagSelect(parentTag, group)
106106

107-
// Find first child index
108-
let firstChildIndex = 0
107+
// Find parent tag index (which is first in visible items when in folder)
108+
let parentIndex = 0
109109
for (const g of nestedBlockTagGroups) {
110110
for (const nestedTag of g.nestedTags) {
111-
if (nestedTag.parentTag === parentTag && nestedTag.children?.[0]) {
112-
const idx = flatTagList.findIndex((item) => item.tag === nestedTag.children![0].fullTag)
113-
firstChildIndex = idx >= 0 ? idx : 0
111+
if (nestedTag.parentTag === parentTag) {
112+
const idx = flatTagList.findIndex((item) => item.tag === nestedTag.parentTag)
113+
parentIndex = idx >= 0 ? idx : 0
114114
break
115115
}
116116
}
117117
}
118118

119119
openFolder(folderId, folderTitle, undefined, selectionCallback)
120-
setSelectedIndex(firstChildIndex)
120+
setSelectedIndex(parentIndex)
121121
}
122122

123123
const handleKeyboardEvent = (e: KeyboardEvent) => {

apps/sim/components/emcn/components/popover/popover.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ const Popover: React.FC<PopoverProps> = ({ children, variant = 'default', ...pro
139139
(id: string, title: string, onLoad?: () => void | Promise<void>, onSelect?: () => void) => {
140140
setCurrentFolder(id)
141141
setFolderTitle(title)
142-
setOnFolderSelect(() => onSelect || null)
142+
setOnFolderSelect(onSelect ?? null)
143143
if (onLoad) {
144144
void Promise.resolve(onLoad())
145145
}

0 commit comments

Comments
 (0)