diff --git a/.github/workflows/trigger.md b/.github/workflows/trigger.md index 986886c02d..a949b46cb5 100644 --- a/.github/workflows/trigger.md +++ b/.github/workflows/trigger.md @@ -1 +1 @@ -oups! +this is the end diff --git a/hivemq-edge-frontend/.tasks/37943-toolbar-search-filter/ARIA_REFERENCE.md b/hivemq-edge-frontend/.tasks/37943-toolbar-search-filter/ARIA_REFERENCE.md new file mode 100644 index 0000000000..a496532280 --- /dev/null +++ b/hivemq-edge-frontend/.tasks/37943-toolbar-search-filter/ARIA_REFERENCE.md @@ -0,0 +1,341 @@ +# ARIA Attributes for Collapsible Toolbar - Reference Guide + +**Task:** 37943-toolbar-search-filter +**Pattern:** WAI-ARIA Disclosure (Show/Hide) + +--- + +## Overview + +This document provides the specific ARIA attributes required for the collapsible toolbar to meet WCAG 2.1 Level AA accessibility standards. + +**Reference:** [WAI-ARIA Disclosure Pattern](https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/) + +--- + +## Required ARIA Attributes + +### 1. Toggle Button + +The button that expands/collapses the toolbar MUST have: + +```tsx + +``` + +**Attributes:** + +- `aria-label`: Descriptive label for screen readers +- `aria-expanded`: Boolean indicating current state ("true" | "false") +- `aria-controls`: ID of the controlled content element + +**Note:** The `aria-label` should change based on state: + +- Collapsed: "Expand workspace toolbar" or "Show workspace tools" +- Expanded: "Collapse workspace toolbar" or "Hide workspace tools" + +--- + +### 2. Content Container + +The container with sections MUST have: + +```tsx + + {/* Sections */} + +``` + +**Attributes:** + +- `id`: Unique identifier matching `aria-controls` on button +- `role`: Either "group" or "region" (region preferred for major sections) +- `aria-label`: Descriptive name for the entire toolbar content + +--- + +### 3. Section 1: Search & Filter + +```tsx + + + + +``` + +**Attributes:** + +- `role="region"`: Identifies as a significant page section +- `aria-label`: Describes the section purpose + +**Why region?** Sections with `role="region"` appear in screen reader landmark navigation, making them easier to find. + +--- + +### 4. Section 2: Layout Controls + +```tsx + + + + + {/* Settings button */} + +``` + +**Attributes:** + +- `role="region"`: Identifies as a significant page section +- `aria-label`: Describes the section purpose + +--- + +### 5. Panel (React Flow) + +The outer Panel component should have: + +```tsx + + {/* Content */} + +``` + +**Attributes:** + +- `role="complementary"`: Landmark role for supporting content +- `aria-label`: High-level description of panel purpose +- `data-testid`: For testing + +--- + +## Complete Example + +```tsx +import { useState } from 'react' +import { Box, IconButton, Icon, Divider } from '@chakra-ui/react' +import { ChevronRightIcon, ChevronLeftIcon } from '@chakra-ui/icons' +import Panel from '@/components/react-flow/Panel' + +const WorkspaceToolbar = () => { + const [isExpanded, setIsExpanded] = useState(false) + + return ( + + {/* Collapsed State: Toggle Button */} + {!isExpanded && ( + + ) +} +``` + +--- + +## Testing ARIA Attributes + +### Manual Testing + +1. **Screen Reader Testing:** + + - Use VoiceOver (Mac) or NVDA (Windows) + - Tab to toggle button + - Verify state announcement ("expanded" or "collapsed") + - Navigate to regions (use landmarks menu) + - Verify region labels are announced + +2. **Keyboard Testing:** + - Tab: Navigate through toolbar + - Enter/Space: Activate toggle button + - Verify focus management + +### Automated Testing (Cypress) + +```tsx +it('should have correct ARIA attributes in collapsed state', () => { + cy.mountWithProviders() + + // Toggle button + cy.get('button[aria-controls="workspace-toolbar-content"]') + .should('have.attr', 'aria-expanded', 'false') + .should('have.attr', 'aria-label') + .and('match', /expand/i) + + // Content should not be visible + cy.get('#workspace-toolbar-content').should('not.exist') +}) + +it('should have correct ARIA attributes in expanded state', () => { + cy.mountWithProviders() + + // Expand + cy.get('button[aria-controls="workspace-toolbar-content"]').click() + + // Toggle button + cy.get('button[aria-controls="workspace-toolbar-content"]') + .should('have.attr', 'aria-expanded', 'true') + .should('have.attr', 'aria-label') + .and('match', /collapse/i) + + // Content exists + cy.get('#workspace-toolbar-content').should('exist').should('have.attr', 'role', 'group') + + // Sections have proper roles + cy.get('[role="region"]').should('have.length', 2) + cy.get('[role="region"]').first().should('have.attr', 'aria-label', 'Search and filter controls') + cy.get('[role="region"]').last().should('have.attr', 'aria-label', 'Layout controls') +}) + +it('should be accessible', () => { + cy.injectAxe() + cy.mountWithProviders() + + // Test collapsed state + cy.checkAccessibility() + + // Expand + cy.get('button[aria-controls="workspace-toolbar-content"]').click() + + // Test expanded state + cy.checkAccessibility() +}) +``` + +--- + +## Common Mistakes to Avoid + +### ❌ WRONG: Missing aria-expanded + +```tsx + +``` + +**Problem:** Screen readers can't announce current state. + +--- + +### ❌ WRONG: aria-expanded as boolean instead of string + +```tsx + +``` + +**Problem:** React will convert to string "true" but TypeScript will complain. + +**Fix:** + +```tsx + +``` + +--- + +### ❌ WRONG: No aria-controls + +```tsx +