refactor(ui5-shellbar): split into features#13010
Draft
dobrinyonkov wants to merge 8 commits intomainfrom
Draft
Conversation
Collaborator
|
🚀 Deployed on https://pr-13010--ui5-webcomponents-preview.netlify.app |
3057b64 to
c7947e3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: