fix(cdk, platform): platform icon tab bar does not detect overflow#13964
Open
MariaIDineva wants to merge 5 commits intomainfrom
Open
fix(cdk, platform): platform icon tab bar does not detect overflow#13964MariaIDineva wants to merge 5 commits intomainfrom
MariaIDineva wants to merge 5 commits intomainfrom
Conversation
✅ Deploy Preview for fundamental-ngx ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.
Related Issue(s)
closes #13962
Description
Problem
The
OverflowListDirectiveonly recalculated overflow onResizeObserverandwindow.resizeevents. When the list content changed dynamically (items added/removed, or text labels updated — e.g. a language switch), the directive did not detect that items now overflow the container. Users would see items spilling out of bounds until they manually resized the window.Root Cause
ContentChildren.changes(item count changes) and had no mechanism to detect text content mutations (label updates).Additional problems
calculateOverflow()usedsetTimeout(0)(a macrotask), which runs after the browser paints, causing a visible flash of overflowed items before they move into the "more" popover.fromEvent(window, 'resize')subscription was never cleaned up on destroy.Changes
overflow-list.directive.tsMutationObserverwatchingchildList+characterData(withsubtree: true) to detect both structural changes (items added/removed via@for) and text content changes (label updates, i18n switches). Attributes are intentionally excluded to avoid infinite loops from our own measurement toggles (hidden,style.display).setTimeout(0)withPromise.resolve().then()— a microtask that runs after DOM mutations but before the browser paints, eliminating the visible flicker._recalcScheduledflag to prevent redundant recalculations when multiple triggers fire in the same task.takeUntilDestroyedto thewindow.resizesubscription andDestroyRef.onDestroycleanup for bothResizeObserverandMutationObserver.calculateOverflow()(localtotalWidth/overflowCountvariables were computed but never used).overflow-list.directive.spec.tsfixture.whenStable().then()withinfakeAsyncwere swallowed by the Promise chain and never actually evaluated. Moved assertions to run synchronously afterflush().HTMLElement.prototypeproperty mocks (offsetWidth,offsetLeft,clientWidth) — which didn't produce meaningful layout in JSDOM — withjest.spyOn(overflowListDir, 'getAmountOfExtraItems')to test the event wiring without depending on JSDOM layout.Array(100).fill(0)→Array.from({ length: 10 }, (_, i) => i)to eliminate Angular NG0955 duplicate track-key warnings.MutationObserver.Examples
platform/icon-tab-barpage calledDynamic Overflowto test and depict the issue and its fix.Moreappears when neededScreenshots
Before:
icon-tab-bar-overflow-bug.mov
After:
icon-tab-bar-dynamic-overflow.mov