-
Notifications
You must be signed in to change notification settings - Fork 279
refactor(ui5-shellbar): split into features #13010
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
🚀 Deployed on https://pr-13010--ui5-webcomponents-preview.netlify.app |
3057b64 to
c7947e3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1.There is an issue, when self-collapsible search is used, when we open shellbar on "s" breakpoint size and refresh the search remains auto-open.
2.Maybe we can create a mechanism, with which we can arrange the actions in custom way.
3.The shadow under shellbar wrapper seems to be missing
4.Infinite rerendering when using custom search and dynamically shrink and expand
Overview
The ShellBar component has been refactored from a monolithic 2000+ line file into a modular architecture with clear separation of concerns. The main
ShellBar.tscomponent now acts as an orchestrator, delegating specific responsibilities to dedicated controller modules.Summary
The refactoring achieves:
Module Dependency Graph
Dependency Flow Pattern
All modules follow a callback injection pattern to avoid circular dependencies:
Key principle: Modules receive getter/setter callbacks → modules never import ShellBar directly → no circular dependencies.
Module Responsibilities
1. ShellBar.ts (Orchestrator)
Location:
packages/fiori/src/ShellBar.tsThe main component that:
onBeforeRendering,onAfterRendering)actionsarray (computed list of enabled action buttons)Key state properties:
2. ShellBarOverflow.ts
Location:
packages/fiori/src/shellbar/ShellBarOverflow.tsHandles responsive item hiding when space is insufficient.
Algorithm:
hideOrderisOverflowing()→ hide next itemshowInOverflow: true→ show overflow button{ hiddenItemsIds, showOverflowButton }Two hiding strategies:
Flickering prevention:
keepHiddenflag keeps previously hidden items hidden during recalculation to prevent brief visibility flashes during resize.3. ShellBarSearch.ts (New Search)
Location:
packages/fiori/src/shellbar/ShellBarSearch.tsController for
ui5-shellbar-searchcomponent (self-collapsible search field).Responsibilities:
ui5-open,ui5-close,ui5-searcheventscollapsed/openproperties with ShellBar stateKey methods:
4. ShellBarSearchLegacy.ts
Location:
packages/fiori/src/shellbar/ShellBarSearchLegacy.tsController for legacy search fields (
ui5-input, custom elements).Differences from ShellBarSearch:
disableSearchCollapsepropertyvalueproperty and nested<input>elements5. IShellBarSearchController.ts (Interface)
Location:
packages/fiori/src/shellbar/IShellBarSearchController.tsCommon interface for search controllers:
ShellBar selects controller based on search field type:
6. ShellBarItemNavigation.ts
Location:
packages/fiori/src/shellbar/ShellBarItemNavigation.tsHandles arrow key navigation between toolbar items.
Supported keys:
←/→- Move focus to previous/next itemHome- Focus first itemEnd- Focus last itemSmart input handling: Allows left/right navigation within input fields when cursor is not at edge.
7. ShellBarAccessibility.ts
Location:
packages/fiori/src/shellbar/ShellBarAccessibility.tsCentralizes ARIA attribute computation.
Provides:
getActionsAccessibilityAttributes()- ARIA attrs for each action buttongetActionsRole()- Returns"toolbar"when multiple actions visiblegetContentRole()- Returns"group"when multiple content items visibleType exports:
8. ShellBarLegacy.ts
Location:
packages/fiori/src/shellbar/ShellBarLegacy.tsHandles deprecated features (to be removed in v3):
logoslotprimaryTitle/secondaryTitlepropertiesmenuItemsslot with menu popoverLazily initialized:
Template Structure
Main Template
Location:
packages/fiori/src/ShellBarTemplate.tsxTemplate Modules
ShellBarSearchTemplate.tsxshellbar/templates/ShellBarSearchLegacyTemplate.tsxshellbar/templates/ShellBarLegacyTemplate.tsxshellbar/templates/CSS Organization
ShellBar.cssShellBarLegacy.cssShellBarSearchLegacy.cssShellBarItem.cssShellBarPopover.cssData Flow: Resize Handling
Type Exports
ShellBar exports types for consumers: