feat(ui5-toolbar): implement WCAG-compliant keyboard navigation#13231
feat(ui5-toolbar): implement WCAG-compliant keyboard navigation#13231plamenivanov91 wants to merge 4 commits intomainfrom
Conversation
Add comprehensive keyboard navigation to toolbar following WCAG toolbar pattern: - Arrow keys (Left/Right/Up/Down) navigate between toolbar items - Home/End jump to first/last item - Tab/Shift+Tab navigate within toolbar, exit at edges - Roving tabindex pattern (single tab stop, toolbar is one stop) - Focus entry: remembers last focused item on re-entry, defaults to first item on initial entry - Proper handling of complex nested controls (ToolbarSelect) Resolves focus loss when pressing Shift+Tab on complex toolbar children. Ensures all toolbar items are reachable via keyboard navigation. Optimizations: - Extracted _focusItem() helper to reduce code duplication - Simplified Tab/Shift+Tab navigation logic Fixes: #12945
|
🚀 Deployed on https://pr-13231--ui5-webcomponents-preview.netlify.app |
|
Tested this PR. Good progress so far, but found a few issues we should fix before merge. Most of them can be reproduced in the toolbar with toolbar items test page here https://pr-13231--ui5-webcomponents-preview.netlify.app/packages/main/test/pages/toolbaritems
RTL not handled Do not check hardcoded tag names Your Adviced is to use the createInstanceChecker but that we not work here so simple duck-type check would work Add a property like // In ToolbarItemBase.ts
@property({ type: Boolean })
handlesOwnKeyboardNavigation = false;
// In ToolbarSelect.ts
handlesOwnKeyboardNavigation = true; // Override in class
// In Toolbar.ts - check the property, not the tag
_shouldItemHandleOwnNavigation(item: ToolbarItemBase): boolean {
return item.handlesOwnKeyboardNavigation;
}Other complex toolbar items can opt-in without modifying the toolbar code. Happy to discuss these over a call. |
Add comprehensive keyboard navigation to toolbar following WCAG toolbar pattern:
Resolves focus loss when pressing Shift+Tab on complex toolbar children. Ensures all toolbar items are reachable via keyboard navigation.
Optimizations:
Fixes: #12945