From 78048eaaa7b6c69cb2bc1e3b41e3562102110224 Mon Sep 17 00:00:00 2001 From: Jonathan Ngbonga <12111716+jongbonga@users.noreply.github.com> Date: Sun, 11 Oct 2026 02:02:43 +0000 Subject: [PATCH] fix: guard the fixed back-button restore against a removed sibling animateFixedBackButton restores the cloned ion-back-button with insertBefore using the body sibling captured when the transition was built. If that sibling leaves the DOM mid-transition, insertBefore throws NotFoundError inside Ionic's afterAddWrite callbacks, the transition promise never resolves and the router outlet stays locked. Check the sibling is still attached and otherwise append the clone. --- src/transition/ios.transition.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/transition/ios.transition.ts b/src/transition/ios.transition.ts index 3c06b1e..18fde6c 100644 --- a/src/transition/ios.transition.ts +++ b/src/transition/ios.transition.ts @@ -140,7 +140,14 @@ const animateFixedBackButton = ( }); root.afterAddWrite(() => { buttons.forEach(({ element, visibility }) => (element.style.visibility = visibility)); - cloneParent.insertBefore(clone, cloneNextSibling); + // The sibling captured at build time may have left the DOM during the + // transition; insertBefore would then throw NotFoundError and the + // transition would never settle. + if (cloneNextSibling && cloneNextSibling.parentNode === cloneParent) { + cloneParent.insertBefore(clone, cloneNextSibling); + } else { + cloneParent.appendChild(clone); + } if (cloneStyle === null) { clone.removeAttribute('style'); } else {