Skip to content

feat: explore graph controls icons - BED-9043 - #3132

Merged
catsiller merged 12 commits into
mainfrom
BED-9043-explore-toolbar-icons
Aug 13, 2026
Merged

feat: explore graph controls icons - BED-9043#3132
catsiller merged 12 commits into
mainfrom
BED-9043-explore-toolbar-icons

Conversation

@catsiller

@catsiller catsiller commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Description

Describe your changes in detail

  1. Replace the Explore graph toolbar’s text controls with icons while keeping all existing behavior.
  2. Add accessible labels and tooltips, improve keyboard and screen-reader support, and return focus to the toolbar after menus close. Also allow BHE to add optional actions to the Export menu while keeping JSON as the default export option.

Local Testing Instructions Provided Below

Motivation and Context

Resolves https://specterops.atlassian.net/browse/BED-9043

Why is this change required? What problem does it solve?

How Has This Been Tested?

Unit Tests & Manual Testing
Manual Testing Instructions below

Standard Testing

  1. Log in to BloodHound.
  2. Navigate to the Explore page.
  3. Hover over each toolbar icon and confirm the following:
  4. Reset Graph: Tooltip says “Reset Graph.” Selecting it resets the graph view.
  5. Labels: Tooltip says “Show Labels” or “Hide Labels.” Selecting it opens the label options.
  6. Layout: Tooltip says “Layout.” Selecting it opens the available layouts.
  7. Export: Tooltip says “Export.” Selecting it opens the Export menu with JSON available.
  8. Search: Tooltip says “Search.” Selecting it opens the current-results search.
  9. Use Tab to navigate through the icons. Confirm each icon shows its tooltip when focused and can be activated with Enter or Space.
  10. Press Escape while a menu is open. Confirm the menu closes and focus returns to its icon.

Screen-Reader Testing

  1. Enable a screen reader and navigate to the Explore page.
  2. Use the keyboard to move through the toolbar.
  3. Confirm each control is announced as a button with one of these names: Reset Graph, Show Labels or Hide Labels, Layout, Export, Search
  4. Confirm the decorative icon itself is not announced separately.
  5. Open each menu and confirm its expanded state and menu options are announced.
  6. Press Escape and confirm the menu closes and focus returns to the correct toolbar button.

Note: please make sure icons work in both light and dark modes

Please describe in detail how you tested your changes.
Include details of your testing environment, and the tests you ran to
see how your change affects other areas of the code, etc.

Screenshots (optional):

Types of changes

  • Chore (a change that does not modify the application functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Database Migrations

Checklist:

Summary by CodeRabbit

  • New Features

    • Added custom actions to the graph Export menu, with labels, callbacks, and disabled states.
    • Improved graph menus with icons, tooltips, keyboard navigation, focus restoration, and accessible controls.
    • Enhanced graph controls and search panel behavior for a more consistent interface.
  • Bug Fixes

    • Improved spacing for empty search results messages.
    • Preserved button labels and custom styling across graph controls.
    • Improved graph layout interaction and fallback behavior.

@catsiller catsiller self-assigned this Aug 11, 2026
@catsiller catsiller added enhancement New feature or request user interface A pull request containing changes affecting the UI code. labels Aug 11, 2026
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 6374baf0-c155-4b79-9b83-190fc69f7cff

📥 Commits

Reviewing files that changed from the base of the PR and between b985020 and 3e0be38.

📒 Files selected for processing (2)
  • packages/javascript/bh-shared-ui/src/components/GraphButton/GraphButton.tsx
  • packages/javascript/bh-shared-ui/src/components/GraphControls/GraphControls.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/javascript/bh-shared-ui/src/components/GraphButton/GraphButton.tsx
  • packages/javascript/bh-shared-ui/src/components/GraphControls/GraphControls.tsx

📝 Walkthrough

Walkthrough

Graph UI controls migrate from Material UI to doodle-ui. GraphControls adds configurable export actions and conditional search rendering. Tests cover accessibility, keyboard behavior, focus restoration, selection, export states, and graph-layout fallback behavior.

Changes

Graph UI migration

Layer / File(s) Summary
GraphButton component migration
packages/javascript/bh-shared-ui/src/components/GraphButton/GraphButton.tsx
GraphButton uses doodle-ui, shared class-name composition, and forwarded button properties.
GraphMenu menu behavior
packages/javascript/bh-shared-ui/src/components/GraphMenu/GraphMenu.tsx, packages/javascript/bh-shared-ui/src/components/GraphMenu/GraphMenu.test.tsx
GraphMenu uses doodle-ui menus, icons, tooltips, and ReactNode children. Tests cover selection, keyboard behavior, closing, and focus restoration.
GraphControls actions and search
packages/javascript/bh-shared-ui/src/components/GraphControls/GraphControls.tsx, packages/javascript/bh-shared-ui/src/components/GraphControls/index.ts, packages/javascript/bh-shared-ui/src/components/SearchCurrentNodes/SearchCurrentNodes.tsx
GraphControls uses doodle-ui controls, exports GraphExportAction, supports additional export actions, and conditionally renders the search panel. Search result spacing is adjusted.
Control behavior validation
packages/javascript/bh-shared-ui/src/components/GraphControls/GraphControls.test.tsx, cmd/ui/src/views/Explore/GraphView.test.tsx
Tests cover accessibility, menu state, keyboard interaction, focus restoration, selection styling, export actions, disabled actions, search behavior, and graph-layout fallback data.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Mergeability Score: ⚪ Minimal · up to 3e0be

This PR replaces the Explore graph toolbar text controls with accessible icons while preserving existing actions and adding optional export actions. No actionable merge-blocking risk remains beyond normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant GraphControls
  participant ExportMenu
  participant GraphExportAction
  User->>GraphControls: Open export menu
  GraphControls->>ExportMenu: Render configured actions and JSON export
  User->>ExportMenu: Select export action
  ExportMenu->>GraphExportAction: Invoke onSelect
  ExportMenu-->>GraphControls: Close menu and restore focus
Loading

Possibly related PRs

Suggested labels: javascript

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: replacing Explore graph controls with icons, and includes the associated ticket.
Description check ✅ Passed The description covers the change, motivation, testing steps, feature type, and associated ticket, but some checklist items remain unchecked.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch BED-9043-explore-toolbar-icons

Comment @coderabbitai help to get the list of available commands.

@catsiller
catsiller changed the base branch from BED-6463-button-refactor to main August 11, 2026 15:47
@catsiller
catsiller changed the base branch from main to BED-6463-button-refactor August 11, 2026 15:49
@catsiller
catsiller force-pushed the BED-9043-explore-toolbar-icons branch from 38f27ac to 1093baa Compare August 11, 2026 16:08
@catsiller
catsiller changed the base branch from BED-6463-button-refactor to main August 11, 2026 16:10
@catsiller
catsiller marked this pull request as ready for review August 12, 2026 21:29
@coderabbitai coderabbitai Bot added the javascript Pull requests that update javascript code label Aug 12, 2026

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 5

🧹 Nitpick comments (1)
packages/javascript/bh-shared-ui/src/components/GraphButton/GraphButton.tsx (1)

31-36: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Use shared design tokens for GraphButton colors.

GraphButton has no in-repository production imports, but packages/javascript/bh-shared-ui/src/index.ts re-exports it through the component barrel. Keep the export unless the public API is changing.

Replace the hardcoded colors with tokens such as bg-neutral-2, text-main, and hover:bg-neutral-3.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/javascript/bh-shared-ui/src/components/GraphButton/GraphButton.tsx`
around lines 31 - 36, Update the className configuration in GraphButton to
replace hardcoded background, text, and hover colors with the shared design
tokens, including bg-neutral-2, text-main, and hover:bg-neutral-3, while
preserving the dark-mode variants and existing component-barrel export.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@packages/javascript/bh-shared-ui/src/components/GraphControls/GraphControls.test.tsx`:
- Around line 379-387: Update the “disables the JSON button if the JSON is
empty” test to call setup with an explicit empty JSON fixture, using setup({
json: {} }). Keep the existing export-menu interaction and aria-disabled
assertion unchanged.

In
`@packages/javascript/bh-shared-ui/src/components/GraphControls/GraphControls.tsx`:
- Line 153: Update the selected state class in GraphControls to make both light
and dark text-color utilities important, matching !bg-primary, and replace the
dark-mode hex color with the appropriate theme token. Verify the rendered
selected text color in both light and dark modes while preserving the existing
background behavior.
- Around line 176-183: In GraphControls, add useRef to the existing React import
and create a ref for the search IconButton. Attach the ref to the button and,
after the SearchCurrentNodes panel closes through onClose or the select handler,
restore focus to that button while preserving the existing state updates.
- Around line 186-190: Add role="search" to the search-current-nodes panel
container near isCurrentSearchOpen, and adjust its rendering or positioning so
the absolutely positioned panel is not clipped by GraphView’s overflow-hidden
ancestor; keep it within available bounds or render it through a portal.

In `@packages/javascript/bh-shared-ui/src/components/GraphMenu/GraphMenu.tsx`:
- Around line 40-45: Remove the manually managed buttonId and menuId values and
stop passing id, aria-controls, and aria-labelledby through the GraphMenu
trigger and content. Preserve aria-label and data-testid on IconButton, allowing
Radix to generate the menu accessibility relationships.

---

Nitpick comments:
In `@packages/javascript/bh-shared-ui/src/components/GraphButton/GraphButton.tsx`:
- Around line 31-36: Update the className configuration in GraphButton to
replace hardcoded background, text, and hover colors with the shared design
tokens, including bg-neutral-2, text-main, and hover:bg-neutral-3, while
preserving the dark-mode variants and existing component-barrel export.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: ac6abda3-4154-48f2-aca0-ad79d8799bab

📥 Commits

Reviewing files that changed from the base of the PR and between 2c28b4a and 252034f.

📒 Files selected for processing (7)
  • packages/javascript/bh-shared-ui/src/components/GraphButton/GraphButton.tsx
  • packages/javascript/bh-shared-ui/src/components/GraphControls/GraphControls.test.tsx
  • packages/javascript/bh-shared-ui/src/components/GraphControls/GraphControls.tsx
  • packages/javascript/bh-shared-ui/src/components/GraphControls/index.ts
  • packages/javascript/bh-shared-ui/src/components/GraphMenu/GraphMenu.test.tsx
  • packages/javascript/bh-shared-ui/src/components/GraphMenu/GraphMenu.tsx
  • packages/javascript/bh-shared-ui/src/components/SearchCurrentNodes/SearchCurrentNodes.tsx

Comment thread packages/javascript/bh-shared-ui/src/components/GraphControls/GraphControls.tsx Outdated
Comment thread packages/javascript/bh-shared-ui/src/components/GraphMenu/GraphMenu.tsx Outdated
@bfaulk96
bfaulk96 self-requested a review August 13, 2026 18:26
Comment thread packages/javascript/bh-shared-ui/src/components/GraphControls/GraphControls.tsx Outdated

@bfaulk96 bfaulk96 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.

Great work, these are some nice looking changes!
Tested locally in both light/dark mode, as well as with a screen reader

@catsiller
catsiller merged commit d547efa into main Aug 13, 2026
14 checks passed
@catsiller
catsiller deleted the BED-9043-explore-toolbar-icons branch August 13, 2026 19:59
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement New feature or request javascript Pull requests that update javascript code user interface A pull request containing changes affecting the UI code.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants