Skip to content

improvement(popover): added keyboard nav to tag dropdown popover to iterate over parent & child items - #1903

Merged
waleedlatif1 merged 3 commits into
stagingfrom
fix/popovers
Nov 11, 2025
Merged

improvement(popover): added keyboard nav to tag dropdown popover to iterate over parent & child items#1903
waleedlatif1 merged 3 commits into
stagingfrom
fix/popovers

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • added keyboard nav to tag dropdown popover to iterate over parent & child items, previously the keyboard navigation ignored parent objects

Type of Change

  • Bug fix

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercelBot commented Nov 11, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
ProjectDeploymentPreviewCommentsUpdated (UTC)
docsSkippedSkippedNov 11, 2025 11:51pm

@waleedlatif1
waleedlatif1 marked this pull request as ready for review November 11, 2025 22:52
@greptile-apps

greptile-appsBot commented Nov 11, 2025

Copy link
Copy Markdown
Contributor

Greptile Overview

Greptile Summary

This PR adds keyboard navigation to the tag dropdown popover, enabling users to navigate through both parent tags and their children using arrow keys. Previously, keyboard navigation ignored parent objects.

Key Changes:

  • Created new KeyboardNavigationHandler component that manages keyboard events and calculates visible indices based on folder state
  • Enhanced Popover component to support onSelect callbacks for folder titles, making parent tags selectable from within folder view
  • Modified PopoverBackButton to render parent tag as a clickable/hoverable item when onFolderSelect is provided
  • Added parentTag property to NestedTag type to track parent-child relationships
  • Integrated keyboard navigation with the popover context for folder state management

Implementation Details:

  • Arrow keys navigate through visibleIndices (root level shows non-child tags, folder level shows parent + children)
  • Arrow Right opens folders, Arrow Left closes them
  • Enter selects current item or opens folder if it's a parent tag
  • Parent tags are now included as the first navigable item when inside a folder

Confidence Score: 3/5

  • This PR improves keyboard navigation but contains a logic bug in folder selection
  • The implementation correctly adds keyboard navigation for parent and child tags, but has a critical logic error in openFolderWithSelection where it selects the first child instead of the parent tag when opening folders. This causes a mismatch between the displayed selection (parent tag in back button) and the keyboard-selected item (first child), breaking the navigation UX. The rest of the implementation is solid with proper context management and clean separation of concerns.
  • keyboard-navigation-handler.tsx requires attention to fix the folder selection index logic

Important Files Changed

File Analysis

FilenameScoreOverview
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel-new/components/editor/components/sub-block/components/tag-dropdown/components/keyboard-navigation-handler.tsx3/5New keyboard navigation handler with logic issue in folder selection index
apps/sim/components/emcn/components/popover/popover.tsx4/5Enhanced popover with folder selection callback support and selectable parent tags
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel-new/components/editor/components/sub-block/components/tag-dropdown/tag-dropdown.tsx4/5Integrated keyboard navigation handler, added back button with parent selection support

Sequence Diagram

sequenceDiagram
participant User
participant TagDropdown
participant KeyboardNav
participant PopoverContext
participant PopoverBackButton
User->>TagDropdown: Opens tag dropdown (< trigger)
TagDropdown->>KeyboardNav: Mount with visible=true
KeyboardNav->>KeyboardNav: Calculate visibleIndices
Note over KeyboardNav: Root level: all non-child tags<br/>In folder: parent tag + children
User->>KeyboardNav: Press ArrowDown/ArrowUp
KeyboardNav->>KeyboardNav: Navigate through visibleIndices
KeyboardNav->>TagDropdown: Update selectedIndex
TagDropdown->>TagDropdown: Scroll item into view
User->>KeyboardNav: Press ArrowRight on parent tag
KeyboardNav->>KeyboardNav: openFolderWithSelection()
KeyboardNav->>PopoverContext: openFolder(id, title, onLoad, onSelect)
PopoverContext->>PopoverContext: Store onFolderSelect callback
KeyboardNav->>TagDropdown: setSelectedIndex to first child
Note over KeyboardNav: Bug: should select parent, not first child
TagDropdown->>PopoverBackButton: Render with parent tag
PopoverBackButton->>PopoverBackButton: Show selectable folder title
User->>KeyboardNav: Navigate in folder
KeyboardNav->>KeyboardNav: Use folder visibleIndices
Note over KeyboardNav: Parent tag is first item
User->>KeyboardNav: Press Enter on parent tag
KeyboardNav->>TagDropdown: handleTagSelect(parentTag)
TagDropdown->>User: Insert parent tag into input
User->>PopoverBackButton: Press ArrowLeft
KeyboardNav->>PopoverContext: closeFolder()
PopoverContext->>PopoverContext: Clear onFolderSelect
KeyboardNav->>TagDropdown: Navigate to first root item
Loading

@greptile-appsgreptile-appsBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

23 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment threadapps/sim/components/emcn/components/popover/popover.tsx Outdated
@waleedlatif1

Copy link
Copy Markdown
CollaboratorAuthor

@greptile

@greptile-appsgreptile-appsBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

23 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@waleedlatif1
waleedlatif1 merged commit 9b702c4 into stagingNov 11, 2025
4 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/popovers branch November 11, 2025 23:53
waleedlatif1 added a commit that referenced this pull request Nov 12, 2025
…terate over parent & child items (#1903)
* improvement(popover): added keyboard nav to tag dropdown popover to iterate over parent & child items
* code cleanup
* ack PR comments
waleedlatif1 added a commit that referenced this pull request Nov 12, 2025
…terate over parent & child items (#1903)
* improvement(popover): added keyboard nav to tag dropdown popover to iterate over parent & child items
* code cleanup
* ack PR comments
@waleedlatif1waleedlatif1 mentioned this pull request Nov 12, 2025
10 tasks
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@waleedlatif1