bug: react-router, page kept for swipe-back stays visible on top when its ionPage outlet is re-entered at a different page in iOS mode
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 50/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- react, typescript
- 領域
- frontend
研究方向
Start by reading StackManager.handleOutOfScopeOutlet and the view lookup logic in findViewItems, which the report identifies as the cause. Reproduce the route sequence in the linked example: Step 1 → Step 2 → Home → Settings → Step 1, then compare iOS and md modes. Done means only the page matching the current pathname remains visible when the nested outlet is re-entered.
由索引模型根據 Issue 內容生成。
描述
Prerequisites
- I have read the Contributing Guidelines.
- I agree to follow the Code of Conduct.
- I have searched for existing issues that already report this problem, without success.
Ionic Framework Version
v9.x
Current Behavior
In iOS mode, an ionPage child outlet can end up with two visible pages. The page that
was active when the user left the outlet is never hidden. When the user later returns to
a different page in the same outlet, the old page stays on screen and covers the new one.
The URL is correct, but the user sees the wrong page. No error is thrown. In the DOM,
neither page is hidden:
<ion-router-outlet class="ion-page …">
<div class="ion-page can-go-back" data-testid="step-1" style="z-index: 101;">…</div>
<div class="ion-page can-go-back" data-testid="step-2" style="z-index: 101;">…</div>
</ion-router-outlet>
The page that comes later in the DOM is drawn on top. In md mode the same navigation
works.
Expected Behavior
Only the page for the current pathname is visible in the outlet. The page that was
active when the user left the outlet is hidden when another page in that outlet enters.
Steps to Reproduce
- Clone the reproduction, check out
swipe-preserved-page-visible, then run
npm installandnpm run dev. - Open
/onboarding/step1. The green Step 1 page is shown. (Each page has its own
background color: Step 1 green, Step 2 red, Home blue, Settings purple.) - Press Next. The app pushes
/onboarding/step2(red). - Press Finish. The app pushes
/home(blue), outside the onboarding outlet. - Press Settings. The app pushes
/settings(purple). - Press Back to Step 1. The app pushes
/onboarding/step1. - Observe: the URL is
/onboarding/step1, but the red Step 2 page is shown. The status
bar at the bottom reports
Visible onboarding pages: step-1, step-2 ← BUG: more than one.
It reproduces on every run (5/5 in Chromium, 3/3 in WebKit). Open
/onboarding/step1?mode=md and repeat the steps to compare: in md mode, the green Step 1
page is shown alone (3/3 runs).
The route shape is:
setupIonicReact({ mode: 'ios' });
<IonRouterOutlet>
<Route path="/onboarding/*" element={
<IonRouterOutlet ionPage>
<Route path="step1" element={<Step1 />} />
<Route path="step2" element={<Step2 />} />
</IonRouterOutlet>
} />
<Route path="/home" element={<HomePage />} />
<Route path="/settings" element={<SettingsPage />} />
</IonRouterOutlet>
All navigation uses router.push(path, 'forward').
Code Reproduction URL
https://github.com/ptmkenny/ionic-react-router-6-test/tree/swipe-preserved-page-visible
Ionic Info
Ionic:
Ionic CLI : 7.2.1 (/home/node/.npm/_npx/f6fddb685269761d/node_modules/@ionic/cli)
Ionic Framework : @ionic/react 9.0.10
Capacitor:
Capacitor CLI : 8.0.0
@capacitor/android : not installed
@capacitor/core : 8.0.0
@capacitor/ios : not installed
Utility:
cordova-res : not installed globally
native-run : 2.0.1
System:
NodeJS : v26.13.0 (/usr/local/bin/node)
npm : 11.20.0
OS : Linux 6.18
Additional Information
I used AI (Opus 5.5) to prepare this issue report and reproduction.
Root cause
StackManager.handleOutOfScopeOutlet has a branch for ionPage outlets whose parent
outlet has swipeGesture === true, which iOS mode enables by default. When the outlet
goes out of scope, this branch keeps every child view mounted, so a swipe back can show
them, and returns. It does not hide the active child page: only the parent outlet hides
the ionPage outlet as a whole.
When the outlet comes back in scope at a different child route, nothing hides that page:
- Finish pushes
/home. The onboarding outlet takes the swipe-preservation branch.
Step 2 stays mounted and not hidden. - Back to Step 1 pushes
/onboarding/step1.findViewItemsresolves the entering
view (Step 1) but no leaving view. It looks the leaving view up by
routeInfo.lastPathname(/settings) and thenrouteInfo.prevRouteLastPathname
(/home). Both belong to the parent outlet, so neither matches a view in this one. - With no leaving view, the transition shows Step 1 and hides nothing. Step 2 has been
visible since the user left the outlet, so both pages are visible.
The extra Settings step is needed only because of the prevRouteLastPathname
fallback. Going straight from Home back to Step 1 leaves prevRouteLastPathname at
/onboarding/step2, so Step 2 is found as the leaving view and hidden. Any two
navigations outside the outlet before returning trigger the bug.
AI-generated fix
Fix commit: https://github.com/ptmkenny/ionic-framework/commit/3d4f4ace71ada7810c654a1b7136d10f28366d07
(branch: https://github.com/ptmkenny/ionic-framework/tree/swipe-preserved-page-visible)
- 主要語言
- TypeScript
- 星號
- 52.8k
- 分支
- 13.3k
- 平均合併
- 3 天 1 小時
- 30 天內合併 PR
- 86
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
ionic-team/ionic-framework 的其他 Issue
-
bug: input-otp, backspace in an empty box only moves focus instead of clearing the previous box可能已有人在做 @sarankumar1325 於 23 天前認領。 未關閉package: core type: bug
難度 2/5 1-3 小時 新手友好度 90/100
ionic-team/ionic-framework#31639 · 1 則留言 ·
維護者通常 1 天內回覆
-
bug: vue swipe cancellation throws when the previous page is missing可能已有人在做 @dandoingdev 於 46 天前認領。 未關閉package: vue type: bug
難度 2/5 1-3 小時 新手友好度 78/100
ionic-team/ionic-framework#31514 · 1 則留言 ·
維護者通常 1 天內回覆
-
bug: ion-searchbar input is always labelled "search text"; aria-label on the host is not forwarded可能已有人在做 @HappyKnuckles 於 41 天前認領。 未關閉a11y package: core type: bug
難度 2/5 1-3 小時 新手友好度 84/100
ionic-team/ionic-framework#31492 · 1 則留言 ·
維護者通常 1 天內回覆
-
bug: IonTabs throws when a Fragment contains one IonRouterOutlet可能已有人在做 @Benziza 於 82 天前認領。 未關閉package: react type: bug
難度 2/5 1-3 小時 新手友好度 72/100
ionic-team/ionic-framework#31410 · 2 則留言 ·
維護者通常 1 天內回覆
-
bug: angular swipe-back gesture crashes in StackController.startBackTransition when the stack is popped before the gesture is captured可能已有人在做 @officialasishkumar 於 9 天前認領。 未關閉package: angular type: bug
難度 2/5 1-3 小時 新手友好度 86/100
ionic-team/ionic-framework#31291 · 1 則留言 ·
維護者通常 1 天內回覆
查看 ionic-team/ionic-framework 的全部 Issue
相似的 Issue
-
ready-for-ai
難度 1/5 1 小時以內 新手友好度 88/100
umbraco/Umbraco-CMS-MCP-Dev#647 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 66/100
HelloAOLab/seed-bible#2173 ·
維護者通常 1 天內回覆
-
enhancement good first issue help wanted
難度 2/5 1-3 小時 新手友好度 88/100
hocinehacherouf/liberarr#77 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 70/100
LibreChat-AI/LibreChat#18225 ·
維護者通常 1 天內回覆
-
b-ber/build/epub b-ber/themes
難度 2/5 1-3 小時 新手友好度 72/100
triplecanopy/b-ber#790 ·
維護者通常 1 天內回覆