Improve truncation and expand logic in sidebar list#82
Merged
kosarko merged 3 commits intolindat-to-dtq-sync251021from Nov 24, 2025
Merged
Improve truncation and expand logic in sidebar list#82kosarko merged 3 commits intolindat-to-dtq-sync251021from
kosarko merged 3 commits intolindat-to-dtq-sync251021from
Conversation
Refactored truncation detection in TruncatablePartComponent for clarity and reliability. Updated SidebarSearchListElementComponent to better track initial truncation state and adjust expandable logic when expanded, ensuring correct UI behavior.
fixed tests
There was a problem hiding this comment.
Pull request overview
This PR improves truncation and expandability tracking in sidebar search list elements by introducing an initialTruncated flag to remember when content was ever truncated, ensuring expand/collapse buttons remain available even after expansion. It also simplifies truncation detection logic by removing unnecessary child element checks and decoupling the isExpanded getter from the expandable state.
Key Changes
- Added
initialTruncatedtracking to preserve expandability state after expansion - Simplified truncation detection by relying solely on scroll/offset height comparison
- Modified expandable state management in components without IDs
- Updated test setup to use correct mock service IDs
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/app/shared/object-list/sidebar-search-list-element/sidebar-search-list-element.component.ts | Added initialTruncated flag and updated updateExpandableState() to preserve expandability after expansion |
| src/app/shared/truncatable/truncatable-part/truncatable-part.component.ts | Simplified truncateElement() logic, removed expandable toggling from toggle methods, changed toggleWithoutId() to set expandable state directly |
| src/app/shared/truncatable/truncatable-part/truncatable-part.component.spec.ts | Updated test to use correct mock service ID ('1' for collapsed state) and added comment explaining the change |
| yarn.lock | Updated multiple dependency versions (unrelated to feature changes) |
src/app/shared/truncatable/truncatable-part/truncatable-part.component.ts
Outdated
Show resolved
Hide resolved
Removed redundant synchronization of the 'expandable' property in the toggleWithoutId method and updated related tests to use the 'expand' property instead. This simplifies state management for components without an id.
Closed
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.
This pull request improves how truncation and expandability are handled in sidebar search list elements and their truncatable parts. The main focus is on ensuring that expandable states are tracked more accurately, especially when children elements are truncated, and simplifying the logic for truncation detection.
Sidebar search list expandability improvements:
initialTruncatedflag toSidebarSearchListElementComponentto remember if any child was ever truncated, ensuring that expandability is preserved even after expansion.updateExpandableState()to use both the current and initial truncation state, so the expandable button remains available if any content was ever truncated, even when expanded.onTruncatedStateChange()to setinitialTruncatedwhen any child is truncated, improving consistency in expandable state tracking.Truncatable part logic simplification:
expandableproperty in bothtoggle()andtoggleWithoutId()methods ofTruncatablePartComponent, as expandability is now managed externally. [1] [2]truncateElement()by removing unnecessary child element checks and relying directly on scroll and offset height, making the code easier to maintain and understand. [1] [2]isExpandedgetter to depend only on theexpandproperty, decoupling it from theexpandablestate for clarity.