content: hardware back button examples never unsubscribe page-scoped handlers
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Documentation
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript, react
- Domain
- documentation
Research direction
Read the hardware back button page and its Angular, Vue, and React examples, then compare the Angular lifecycle guidance and the corresponding page in versioned_docs/version-v8/. Update both versions with page-scoped subscription cleanup, the AppComponent exception, and why ngOnDestroy alone is insufficient. Done when all framework examples explain and demonstrate cleanup consistently.
Written by the indexing model from the issue text.
Description
URL
https://ionicframework.com/docs/developing/hardware-back-button
Issue Description
The Angular examples on this page call platform.backButton.subscribeWithPriority in a constructor and never unsubscribe. That is fine in AppComponent, but on a routed page the handler outlives the page. A popped page that registered later wins presses over the page on screen, and a page still in the stack takes presses made on the page pushed over it, so navigation never pops. Reported in ionic-team/ionic-framework#31366.
Please add a section on page-scoped handlers that:
- Subscribes in
ionViewDidEnterand unsubscribes inionViewWillLeave, matching the cleanup guidance on the Angular lifecycle page. - Notes that handlers registered in
AppComponentneed no cleanup. - Notes that unsubscribing in
ngOnDestroyalone leaves the handler active while the page sits in the stack under another page.
The Vue and React tabs have the same gap: useBackButton returns unregister, and the React example adds a listener it never removes. Please update versioned_docs/version-v8/ as well.
- Dominant language
- MDX
- Stars
- 620
- Forks
- 3.2k
- Avg merge
- 15h 17m
- Merged PRs (30d)
- 52
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ionic-team/ionic-docs
-
content
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
ionic-team/ionic-docs#4804 ·
Maintainers usually reply within 1 day
-
content: sheet modal docs should explain how to keep interactive content from dragging the sheetOpencontent
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ionic-team/ionic-docs#4765 ·
Maintainers usually reply within 1 day
-
content
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
ionic-team/ionic-docs#4705 ·
Maintainers usually reply within 1 day
-
content package: angular
Difficulty 2/5 Half a day Newbie friendliness 78/100
ionic-team/ionic-docs#4702 ·
Maintainers usually reply within 1 day
-
triage
Difficulty 1/5 Under an hour Newbie friendliness 80/100
ionic-team/ionic-docs#4546 ·
Maintainers usually reply within 1 day
All issues in ionic-team/ionic-docs
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
grafana/profiles-drilldown#1212 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
grafana/traces-drilldown#980 ·
Maintainers usually reply within 1 day
-
sync-en
Difficulty 1/5 Under an hour Newbie friendliness 75/100
Maintainers usually reply within 2 days