-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(nav): avoid doing double reflow for fade in transition (#3936)
Double reflow issue caused styles + layout calculation with tab pane hidden (without `.active`). This caused window scroll positition adjustment as if tab pane wasn't there. ``` Before: - reflow() in ngbRunTransition - add('.active') in ngbNavFadeInTransition - reflow() in ngbNavFadeInTransition - add('.show') in ngbNavFadeInTransition After: - add('.active') in NgbNavOutlet - reflow() in ngbRunTransition - add('.show') in ngbNavFadeInTransition ``` Fixes #3900
- Loading branch information
1 parent
50a0ea1
commit 76e38ee
Showing
3 changed files
with
36 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,10 @@ | ||
import {NgbTransitionStartFn} from '../util/transition/ngbTransition'; | ||
import {reflow} from '../util/util'; | ||
|
||
export const ngbNavFadeOutTransition: NgbTransitionStartFn = ({classList}) => { | ||
classList.remove('show'); | ||
return () => classList.remove('active'); | ||
}; | ||
|
||
export const ngbNavFadeInTransition: NgbTransitionStartFn = (element: HTMLElement) => { | ||
element.classList.add('active'); | ||
reflow(element); | ||
element.classList.add('show'); | ||
}; | ||
|
||
export const ngbNavFadeInNoReflowTransition: NgbTransitionStartFn = (element: HTMLElement) => { | ||
element.classList.add('active'); | ||
element.classList.add('show'); | ||
}; |
This file contains 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