mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-14 21:26:15 -08:00
fix(workspace): read scroll and focus state before a view's DOM detaches
Without the @angular/animations renderer a destroyed view's DOM leaves before its destroy hooks run, which the deferred removal used to hide. Two hooks read state from the detached DOM: - CategoryContentView.ngOnDestroy saved the grid's scrollTop, which reads 0 once detached, over the offset saved when a card was clicked: back from a VOD detail landed at the top of the list (catalog-sorting E2E on every OS). The view now keeps the offset of the grid that scrolled last; a grid rendered since (a new category's) saves the top. - Chromium blurs a focused element synchronously while removing it, so removing the focused player settings panel fired a focusout without a relatedTarget before the panel's destroy hook, which cleared focusInside: Escape left focus on the page instead of the tune button (player-controls-keyboard web E2E). The panel now judges a focusout a microtask later: a removed panel is detached then, while a pointer release blurs a panel that stays attached and still drops focus. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
67cf84f490
commit
d8ee38b6d1
5 files changed
+187
-6
No files matched your search
@@ -234,6 +234,15 @@ records no shift. `app.config.spec.ts` keeps the animations renderer out, and
|
||||
`workspace-route-swap.e2e.ts` asserts that no mutation checkpoint holds both
|
||||
pages and that neither the dashboard nor the content pane shifts.
|
||||
|
||||
Destroy hooks therefore run with the view's DOM already detached, where
|
||||
`scrollTop` reads 0 and focus has dropped to `body`. Chromium blurs a focused
|
||||
element synchronously while removing it, so its `focusout` (no
|
||||
`relatedTarget`) arrives before the hook. The deferred removal used to hide
|
||||
this. Record what a hook needs while the view is attached: the catalog keeps
|
||||
the offset of the grid that scrolled last, and the player settings panel
|
||||
judges a `focusout` a microtask later, when a removed panel is detached and a
|
||||
pointer-blurred one is not.
|
||||
|
||||
Do not add `provideAnimations()` or `provideAnimationsAsync()` back; animate
|
||||
with CSS. A leave animation (`animate.leave` included) delays its element's
|
||||
removal in the same way, so a routed page must not carry one.
|
||||
|
||||
Reference in new issue
Block a user