|
| 1 | +# Task: 37943-toolbar-search-filter |
| 2 | + |
| 3 | +## Objective |
| 4 | + |
| 5 | +Combine the layout controls toolbar (top-left) and search/filter toolbar (top-right) into a single collapsible toolbar positioned at the top-left of the canvas. |
| 6 | + |
| 7 | +## Context |
| 8 | + |
| 9 | +This is a follow-up to task 25337 (workspace-auto-layout), where we created a layout controls toolbar positioned at the top-left of the canvas. During that task, two improvements were mentioned for the layout toolbar: |
| 10 | + |
| 11 | +- Make the toolbar expandable to reduce footprint on the canvas |
| 12 | +- Make the toolbar responsive, possibly turning to icon-only with small media size |
| 13 | + |
| 14 | +There is an existing search & filter toolbar positioned on the top-right of the canvas (CanvasToolbar.tsx). This toolbar already has collapse/expand functionality. |
| 15 | + |
| 16 | +## Current State |
| 17 | + |
| 18 | +### Layout Controls Panel (Top-Left) |
| 19 | + |
| 20 | +- **Location:** `src/modules/Workspace/components/controls/LayoutControlsPanel.tsx` |
| 21 | +- **Position:** `top-left` of canvas |
| 22 | +- **Components:** |
| 23 | + - LayoutSelector - Algorithm selection dropdown |
| 24 | + - ApplyLayoutButton - Apply layout button |
| 25 | + - LayoutPresetsManager - Manage saved presets |
| 26 | + - Settings button - Opens LayoutOptionsDrawer |
| 27 | +- **State:** Always expanded, no collapse functionality |
| 28 | +- **Tests:** `LayoutControlsPanel.spec.cy.tsx` (7 tests including accessibility) |
| 29 | + |
| 30 | +### Search/Filter Toolbar (Top-Right) |
| 31 | + |
| 32 | +- **Location:** `src/modules/Workspace/components/controls/CanvasToolbar.tsx` |
| 33 | +- **Position:** `top-right` of canvas |
| 34 | +- **Components:** |
| 35 | + - SearchEntities - Search input |
| 36 | + - DrawerFilterToolbox - Filter drawer trigger |
| 37 | + - Expand/Collapse buttons |
| 38 | +- **State:** Collapsible with animated transitions |
| 39 | +- **Tests:** `CanvasToolbar.spec.cy.tsx` (1 test) |
| 40 | + |
| 41 | +## Goal |
| 42 | + |
| 43 | +Merge both toolbars into a single collapsible toolbar at top-left with: |
| 44 | + |
| 45 | +- **Section 1 (Top):** Search & Filter controls |
| 46 | +- **Section 2 (Bottom):** Layout controls |
| 47 | + |
| 48 | +## Proposed Layout |
| 49 | + |
| 50 | +``` |
| 51 | +┌────────────────��────────────┐ |
| 52 | +│ [Expand Button + Icons] │ ← Collapsed state |
| 53 | +└─────────────────────────────┘ |
| 54 | +
|
| 55 | +┌─────────────────────────────┐ |
| 56 | +│ ╔═══════════════════════╗ │ |
| 57 | +│ ║ SEARCH & FILTER ║ │ ← Section 1 |
| 58 | +│ ║ - Search input ║ │ |
| 59 | +│ ║ - Filter button ║ │ |
| 60 | +│ ╚═══════════════════════╝ │ |
| 61 | +│ │ |
| 62 | +│ ╔═══════════════════════╗ │ |
| 63 | +│ ║ LAYOUT CONTROLS ║ │ ← Section 2 |
| 64 | +│ ║ - Algorithm selector ║ │ |
| 65 | +│ ║ - Apply button ║ │ |
| 66 | +│ ║ - Presets manager ║ │ |
| 67 | +│ ║ - Settings button ║ │ |
| 68 | +│ ╚═══════════════════════╝ │ |
| 69 | +│ │ |
| 70 | +│ [Collapse Button] │ |
| 71 | +└─────────────────────────────┘ |
| 72 | +``` |
| 73 | + |
| 74 | +## Acceptance Criteria |
| 75 | + |
| 76 | +1. ✅ Single toolbar positioned at `top-left` of canvas |
| 77 | +2. ✅ Collapsible with smooth animations (reuse existing animation constants) |
| 78 | +3. ✅ Search & Filter section at the top |
| 79 | +4. ✅ Layout Controls section at the bottom |
| 80 | +5. ✅ Proper ARIA attributes for collapsed/expanded states: |
| 81 | + - `aria-expanded="true|false"` on toggle button |
| 82 | + - `aria-controls` pointing to content ID |
| 83 | + - `aria-label` describing the toolbar purpose |
| 84 | +6. ✅ Visual separation between sections (divider or spacing) |
| 85 | +7. ✅ All existing tests passing |
| 86 | +8. ✅ New accessibility tests covering: |
| 87 | + - Collapsed state accessibility |
| 88 | + - Expanded state accessibility |
| 89 | + - Section navigation with screen readers |
| 90 | +9. ✅ Responsive behavior (optional enhancement for media queries) |
| 91 | + |
| 92 | +## Technical Requirements |
| 93 | + |
| 94 | +### ARIA Attributes for Collapsible Widgets |
| 95 | + |
| 96 | +According to WAI-ARIA best practices for disclosure (show/hide) widgets: |
| 97 | + |
| 98 | +- Toggle button MUST have `aria-expanded="true"` when expanded, `"false"` when collapsed |
| 99 | +- Toggle button SHOULD have `aria-controls="id"` pointing to the content element |
| 100 | +- Content element SHOULD have a unique `id` |
| 101 | +- Toggle button MUST have descriptive `aria-label` |
| 102 | +- Sections within expanded content SHOULD have `role="region"` with `aria-label` for screen reader navigation |
| 103 | + |
| 104 | +### Guidelines to Follow |
| 105 | + |
| 106 | +- **Testing Guidelines:** `.tasks/TESTING_GUIDELINES.md` |
| 107 | + - Mandatory accessibility test pattern |
| 108 | + - Component test patterns |
| 109 | + - Test naming conventions |
| 110 | +- **Design Guidelines:** `.tasks/DESIGN_GUIDELINES.md` |
| 111 | + - Button variant usage |
| 112 | + - UI component patterns |
| 113 | +- **Reporting Strategy:** `.tasks/REPORTING_STRATEGY.md` |
| 114 | + - Create CONVERSATION_SUBTASK_N.md for each subtask |
| 115 | + - Update TASK_SUMMARY.md after each phase |
| 116 | + |
| 117 | +## Implementation Notes |
| 118 | + |
| 119 | +- Reuse existing animation constants from `src/modules/Theme/utils.ts` |
| 120 | +- Consider creating a shared `CollapsibleToolbar` wrapper component |
| 121 | +- Ensure feature flag `config.features.WORKSPACE_AUTO_LAYOUT` still controls layout section visibility |
| 122 | +- Maintain existing keyboard shortcuts (Ctrl/Cmd+L for apply layout) |
| 123 | +- Keep existing drawer components (LayoutOptionsDrawer, DrawerFilterToolbox) functional |
| 124 | + |
| 125 | +## Related Files |
| 126 | + |
| 127 | +### Components to Modify |
| 128 | + |
| 129 | +- `src/modules/Workspace/components/controls/LayoutControlsPanel.tsx` |
| 130 | +- `src/modules/Workspace/components/controls/CanvasToolbar.tsx` |
| 131 | +- `src/modules/Workspace/components/ReactFlowWrapper.tsx` (imports both toolbars) |
| 132 | + |
| 133 | +### Tests to Update |
| 134 | + |
| 135 | +- `src/modules/Workspace/components/controls/LayoutControlsPanel.spec.cy.tsx` |
| 136 | +- `src/modules/Workspace/components/controls/CanvasToolbar.spec.cy.tsx` |
| 137 | + |
| 138 | +### Utility Files |
| 139 | + |
| 140 | +- `src/modules/Theme/utils.ts` (animation constants) |
| 141 | + |
| 142 | +## References |
| 143 | + |
| 144 | +- WAI-ARIA Disclosure Pattern: https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/ |
| 145 | +- Task 25337: `.tasks/25337-workspace-auto-layout/` |
0 commit comments