Skip to content

Conversation

@vanch3d
Copy link
Contributor

@vanch3d vanch3d commented Oct 31, 2025

Pull Request: Unified Responsive Toolbar with Search & Layout Controls

Kanban Ticket: https://hivemq.kanbanize.com/ctrl_board/57/cards/37943/details/


Description

This PR transforms the workspace canvas toolbar experience by unifying the search/filter controls and layout controls into a single, collapsible, responsive toolbar. Previously, users had two separate panels competing for space at the top of the canvas. Now, users have a streamlined toolbar that adapts to any screen size while providing quick access to all essential workspace controls.

The enhancement introduces:

  • Unified Toolbar: Combined search/filter and layout controls into one cohesive interface at the top-left corner
  • Full Responsiveness: Mobile-first design that adapts from 320px phones to 1920px+ desktops with vertical and horizontal layouts
  • Collapsible Interface: Reduces canvas footprint when controls aren't needed, maximizing workspace visibility
  • Complete Accessibility: Full ARIA disclosure pattern implementation with screen reader support
  • Visual Feedback: Icon rotation and adaptive tooltips provide clear directional cues for expansion/collapse

User Experience Improvements

What users gain:

  • More Canvas Space: Toolbar collapses to a minimal 56-80px width when not in use, freeing up valuable canvas real estate
  • Better Mobile Experience: Full-width vertical layout on mobile devices (< 768px) with touch-optimized 48px tap targets
  • Unified Workflow: All canvas controls in one location - no more hunting between separate panels
  • Adaptive Design: Toolbar automatically adjusts layout based on screen size without losing functionality
  • Clear Visual Cues: Rotated chevron icons (down/up on mobile, left/right on desktop) show expansion direction
  • Keyboard Efficiency: Ctrl/Cmd+L shortcut still applies layout even when toolbar is collapsed

Technical Summary

Implementation highlights:

  • Migrated layout controls from standalone LayoutControlsPanel into existing CanvasToolbar component
  • Implemented Chakra UI responsive syntax (mobile-first) with breakpoints at 768px (md) and 1280px (xl)
  • Added WAI-ARIA Disclosure pattern with aria-expanded, aria-controls, and role="region" attributes
  • Used useBreakpointValue for responsive props that don't support object syntax (divider orientation, tooltip placement)
  • Updated 27 E2E tests and 10 component tests to work with unified toolbar
  • Added test-id to settings button and updated Page Objects for reliable E2E testing

BEFORE

Previous Behavior - Separate Control Panels

The old implementation used two independent panels positioned at different corners of the canvas:

Limitations:

  • Layout Controls Panel (top-left) and Search Toolbar (top-right) competed for screen space
  • Both panels always visible, reducing available canvas area
  • No responsive behavior - same layout on all screen sizes caused cramping on tablets/phones
  • Inconsistent positioning made workflow less intuitive
  • Layout controls panel lacked collapse functionality
HiveMQ-Edge-11-03-2025_05_33_AM

AFTER

New Behavior - Unified Responsive Toolbar

The new implementation combines both control sets into a single adaptive toolbar that optimizes for every screen size:

1. Desktop View - Collapsed State (>= 1280px)

The toolbar starts in a minimal collapsed state, showing only an expand button with search icon:

HiveMQ-Edge-11-03-2025_05_24_AM

Test: cypress/e2e/workspace/workspace-layout-basic.spec.cy.ts - "should display layout controls in workspace"
Screenshot: 1280x800 viewport showing collapsed toolbar at top-left

Key Visual Elements:

  • Expand Button: Right-pointing chevron (→) with search icon indicates horizontal expansion
  • Compact Size: Only 80px wide, maximizing canvas space
  • Top-Left Position: Prime location for frequent access without blocking content

User Benefits:

Users get maximum canvas space for viewing their workspace topology while still having quick access to controls with a single click.

2. Desktop View - Expanded State (>= 1280px)

Clicking the expand button reveals all controls in a horizontal layout:

HiveMQ-Edge-11-03-2025_05_23_AM

Test: cypress/e2e/workspace/workspace-layout-basic.spec.cy.ts - "should display layout controls in workspace"
Screenshot: 1280x800 viewport showing expanded toolbar with all controls

Key Visual Elements:

  • Search Section: Search input and filter button on the left
  • Vertical Divider: Clear visual separation between search and layout sections
  • Layout Section: Algorithm selector, apply button, presets, and settings on the right
  • Collapse Button: Left-pointing chevron (←) at the far right
  • Horizontal Flow: All controls arranged in a single row, max width 1280px

User Benefits:

All workspace controls accessible in one location with clear organization. The horizontal layout is space-efficient and familiar to desktop users.

3. Mobile View - Collapsed State (< 768px)

On mobile devices, the toolbar adapts to vertical orientation:

HiveMQ-Edge-11-03-2025_05_32_AM

Test: cypress/e2e/workspace/workspace-layout-basic.spec.cy.ts - "should display layout controls in workspace"
Screenshot: 375x667 viewport (iPhone SE) showing collapsed mobile toolbar

Key Visual Elements:

  • Expand Button: Down-pointing chevron (↓) with search icon indicates vertical expansion
  • Touch-Optimized: 48px minimum tap target meets WCAG AAA standards
  • Full-Width Ready: Button spans available width for easy tapping

User Benefits:

Mobile users get a touch-friendly button that's easy to tap, with clear visual feedback showing the toolbar will expand downward.

4. Mobile View - Expanded State (< 768px)

When expanded on mobile, the toolbar becomes a full-width vertical panel:

HiveMQ-Edge-11-03-2025_05_36_AM

Test: cypress/e2e/workspace/workspace-layout-basic.spec.cy.ts - "should display layout controls in workspace"
Screenshot: 375x667 viewport showing full vertical toolbar layout

Key Visual Elements:

  • Search Controls: Full-width search input and filter button stacked vertically
  • Horizontal Divider: Separates search and layout sections
  • Layout Controls: All layout buttons stacked vertically at full width
  • Collapse Button: Up-pointing chevron (↑) centered at bottom
  • Touch Spacing: Larger gaps (12px) between elements for fat-finger friendliness

User Benefits:

Mobile users get full-width controls that are easy to tap accurately, with vertical stacking that follows natural scrolling behavior. No horizontal scrolling or tiny buttons.

5. Tablet View - Hybrid Layout (768px - 1279px)

Tablets get a semi-vertical layout with row-based control grouping:

HiveMQ-Edge-11-03-2025_05_37_AM

Test: cypress/e2e/workspace/workspace-layout-basic.spec.cy.ts - "should display layout controls in workspace"
Screenshot: 768x1024 viewport (iPad) showing tablet-optimized layout

Key Visual Elements:

  • Vertical Sections: Main structure is vertical like mobile
  • Row Grouping: Within sections, controls arranged in rows (e.g., [Search] [Filter])
  • 90% Width: Leaves margin on sides for better visual hierarchy
  • Auto-Width Controls: Buttons take natural size, not forced full-width

User Benefits:

Tablet users get an optimized middle-ground that takes advantage of more screen width while maintaining touch-friendly sizing.


Test Coverage

Comprehensive Testing

  • 37 tests total, all passing ✅
    • Component tests: 10 tests for CanvasToolbar component
    • E2E tests: 27 tests across 5 workspace layout test files

Performance Impact

Positive improvements:

  • Reduced DOM elements: Single toolbar instead of two separate panels
  • CSS-only responsive: No JavaScript calculations for layout changes, uses Chakra UI's responsive props
  • Hardware-accelerated animations: Icon rotation uses CSS transforms (400ms cubic-bezier)
  • Minimal re-renders: Toolbar state isolated with useState, doesn't affect parent components
  • No new dependencies: Leverages existing Chakra UI components

Accessibility

Full WCAG 2.1 Level AA compliance:

  • ARIA Disclosure Pattern: Complete implementation with aria-expanded, aria-controls, role="region"
  • Descriptive Labels: All interactive elements have clear aria-label attributes
  • Keyboard Navigation: Tab order logical, all controls keyboard accessible
  • Focus Management: Visible focus indicators on all interactive elements
  • Touch Targets: 48px minimum on mobile (WCAG AAA), 40px on desktop (WCAG AA)
  • Screen Reader Support: Sections announced as landmarks with descriptive labels
  • No Color Reliance: Icon shapes provide meaning independent of color
  • Axe-core Validated: All component tests include accessibility checks with no violations

Accessibility Testing:

  • Component test: should be accessible - validates with axe-core
  • E2E test: should have accessible layout controls - validates expanded/collapsed states
  • E2E test: should have proper ARIA labels - validates all ARIA attributes present

Future Enhancements

Optional improvements that could be done later:

  • Auto-collapse on mobile: Automatically collapse toolbar after interaction to save screen space
  • Swipe gestures: Add touch swipe gestures for expand/collapse on mobile devices
  • Persistent state: Remember user's collapsed/expanded preference in localStorage
  • Animation refinements: Direction-aware slide animations matching expansion direction
  • Reduced motion support: Respect prefers-reduced-motion media query for accessibility
  • Additional breakpoint: Fine-tune tablet experience at 992px (lg) breakpoint
  • Keyboard shortcut legend: Display available shortcuts in a help dialog
  • Landscape optimization: Different layout for mobile landscape orientation

Reviewer Notes

Focus areas for review:

  1. Responsive Behavior: Test toolbar at various screen widths (320px, 768px, 1280px) to verify layout changes
  2. Accessibility: Verify screen reader announces states correctly, keyboard navigation works smoothly
  3. E2E Test Changes: Review the pattern of adding workspacePage.canvasToolbar.expandButton.click() - it's consistent across all 27 tests
  4. Icon Transformations: Verify chevron icons rotate correctly at different breakpoints (down/up on mobile, left/right on desktop)

Manual testing suggestions:

  1. Open the workspace in your browser
  2. Observe the toolbar at top-left in collapsed state (should show expand button with search icon)
  3. Click the expand button
  4. Verify all controls appear: search, filter, divider, layout selector, apply, presets, settings
  5. Click various layout controls to ensure they work
  6. Use Ctrl/Cmd+L keyboard shortcut (should work even when toolbar is collapsed) ✅
  7. Click collapse button - toolbar should minimize to save space
  8. Resize browser window from 1280px down to 768px and 375px - observe layout changes
  9. On narrow widths, verify vertical layout with full-width buttons

Quick test commands:

# Run all component tests
pnpm cypress:run:component --spec "src/modules/Workspace/components/controls/CanvasToolbar.spec.cy.tsx"

# Run all layout E2E tests
pnpm cypress:run:e2e --spec "cypress/e2e/workspace/workspace-layout*.spec.cy.ts"

# Run specific E2E test file
pnpm cypress:run:e2e --spec "cypress/e2e/workspace/workspace-layout-basic.spec.cy.ts"

# Check TypeScript errors
pnpm build:tsc

Expected test results:

  • Component tests: 10/10 passing ✅
  • E2E tests: 27/27 passing ✅
  • No TypeScript errors ✅
  • No accessibility violations ✅

Migration Notes

For users:

  • No migration needed - toolbar starts collapsed by default, click to expand when needed
  • All existing keyboard shortcuts continue to work (Ctrl/Cmd+L)
  • Layout controls in new location (top-left instead of separate panel) but same functionality

For developers:

  • LayoutControlsPanel component removed - functionality now in CanvasToolbar
  • Page Object updated: Use workspacePage.canvasToolbar.expandButton.click() before accessing layout controls in E2E tests
  • Settings button now has data-testid="workspace-layout-options" for reliable testing
  • Responsive props use Chakra UI object syntax: { base, md, xl } for mobile-first approach

Related Links

  • Task Documentation: .tasks/37943-toolbar-search-filter/
  • Previous Task: Task 25337 (workspace-auto-layout) - Created the layout controls that are now unified
  • Visual Guide: .tasks/37943-toolbar-search-filter/RESPONSIVE_VISUAL_GUIDE.md
  • Test Results: .tasks/37943-toolbar-search-filter/E2E_TEST_RESULTS.md

Ready for Review

@vanch3d vanch3d self-assigned this Oct 31, 2025
@cla-bot cla-bot bot added the cla-signed label Oct 31, 2025
@github-actions
Copy link

github-actions bot commented Oct 31, 2025

Test Results

  474 files  ±0    474 suites  ±0   4m 11s ⏱️ ±0s
3 982 tests ±0  3 979 ✅ ±0  3 💤 ±0  0 ❌ ±0 
3 999 runs  ±0  3 996 ✅ ±0  3 💤 ±0  0 ❌ ±0 

Results for commit 0fbd974. ± Comparison against base commit 9245eee.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Oct 31, 2025

Coverage Report

Overall Project 65.07%

There is no coverage information present for the Files changed

@vanch3d vanch3d requested a review from Copilot November 3, 2025 05:22
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements a comprehensive toolbar consolidation feature that combines the layout controls and search/filter toolbars into a single unified, collapsible, responsive toolbar. The implementation includes full accessibility support, extensive testing updates, and removal of a feature flag (WORKSPACE_AUTO_LAYOUT). The work spans multiple subtasks including ARIA attribute additions, toolbar integration, test updates, responsive design implementation, and E2E test adjustments.

Key Changes:

  • Unified toolbar combining search/filter and layout controls into a single collapsible component at top-left
  • Removed WORKSPACE_AUTO_LAYOUT feature flag - layout features are now always enabled
  • Added comprehensive responsive design with mobile-first approach (breakpoints at 768px and 1280px)
  • Updated all layout-related E2E tests to expand toolbar before accessing controls
  • Simplified manual layout algorithm tests to remove unnecessary parameter testing

Reviewed Changes

Copilot reviewed 41 out of 41 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
manual-layout.spec.ts Simplified test suite removing redundant options/constraints parameter tests
useWorkspaceStore.ts Removed feature flag check for persisting layout config
LayoutSelector.tsx Removed feature flag conditional rendering
LayoutSelector.spec.cy.tsx Removed feature flag setup from tests
LayoutPresetsManager.tsx Wrapped MenuList in Portal for better rendering
LayoutPresetsManager.spec.cy.tsx Removed feature flag setup
LayoutOptionsDrawer.spec.cy.tsx Removed feature flag setup
ApplyLayoutButton.tsx Removed feature flag check and added minWidth style
ApplyLayoutButton.spec.cy.tsx Removed feature flag setup
DrawerFilterToolbox.tsx Removed margin styling
LayoutControlsPanel.tsx File deleted (merged into CanvasToolbar)
LayoutControlsPanel.spec.cy.tsx File deleted (tests moved to CanvasToolbar)
CanvasToolbar.tsx Major refactor: moved to top-left, added layout controls, responsive design
CanvasToolbar.spec.cy.tsx Added 9 new tests, updated wrapper to include EdgeFlowProvider
ReactFlowWrapper.tsx Removed LayoutControlsPanel import and usage
config/index.ts Removed WORKSPACE_AUTO_LAYOUT feature flag
WorkspacePage.ts Added canvasToolbar page object with expand/collapse buttons
workspace-layout-*.spec.cy.ts Added toolbar expand step to all layout E2E tests (5 files)
TESTING_GUIDELINES.md Added critical rule about never declaring test work complete without running tests
AUTONOMY_TEMPLATE.md Added critical rule about test-related subtask completion
ACTIVE_TASKS.md Added task 37943 documentation
Task documentation files Created comprehensive documentation for the task (15+ new files)
Comments suppressed due to low confidence (1)

hivemq-edge-frontend/src/modules/Workspace/components/controls/CanvasToolbar.tsx:1

  • These commented-out responsive width properties suggest uncertainty about the final implementation. Either uncomment and use them if they're needed, or remove the comments entirely to keep the code clean. Dead code should not be committed.
import type { FC } from 'react'

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants