content: Missing Event type when trying to subscribe to 'ionBackButton' with React.
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 45/100
- Issue type
- Documentation
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- react, typescript
- Domain
- documentation
Research direction
Open the hardware back button documentation at the URL in the issue and review the React subscription example. Reproduce the TypeScript error with the documented code, then update the example or its explanation so the documented approach handles the event detail without an unsafe cast; done means the example type-checks for React users.
Written by the indexing model from the issue text.
Description
URL
https://ionicframework.com/docs/developing/hardware-back-button
Issue Description
When trying to subscribe to 'ionBackButton' the way it is written on the docs, the compiler complains about the property detail with the message: "Property 'detail' does not exist on type 'Event'.ts(2339)".
The current solution is to cast the event parameter to any. Other solutions have been tried, like casting to BackButtonEvent from @ionic/react or @ionic/core.
Image below is how I found the current solution on the Ionic discord:
npm ls:
├── @capacitor-community/admob@7.0.3
├── @capacitor-community/keep-awake@7.1.0
├── @capacitor/android@7.4.2
├── @capacitor/app@7.0.1
├── @capacitor/assets@3.0.5
├── @capacitor/browser@7.0.2
├── @capacitor/cli@7.4.2
├── @capacitor/core@7.4.2
├── @capacitor/device@7.0.2
├── @capacitor/haptics@7.0.1
├── @capacitor/ios@7.4.2
├── @capacitor/keyboard@7.0.1
├── @capacitor/status-bar@7.0.1
├── @ionic/core@8.7.3
├── @ionic/react-router@8.7.1
├── @ionic/react@8.7.1
├── @testing-library/dom@10.4.1
├── @testing-library/jest-dom@5.17.0
├── @testing-library/react@16.3.0
├── @testing-library/user-event@14.6.1
├── @types/react-dom@19.0.4
├── @types/react-router-dom@5.3.3
├── @types/react-router@5.1.20
├── @types/react@19.0.10
├── @vitejs/plugin-legacy@7.2.1
├── @vitejs/plugin-react@4.7.0
├── cypress@13.17.0
├── eslint-plugin-react-hooks@5.2.0
├── eslint-plugin-react-refresh@0.4.20
├── eslint-plugin-react@7.37.5
├── eslint@9.32.0
├── globals@15.15.0
├── ionicons@7.4.0
├── jsdom@22.1.0
├── react-dom@19.0.0
├── react-router-dom@5.3.4
├── react-router@5.3.4
├── react@19.0.0
├── terser@5.43.1
├── typescript-eslint@8.38.0
├── typescript@5.8.3
├── vite@7.1.1
└── vitest@3.2.4
- Dominant language
- MDX
- Stars
- 621
- Forks
- 3.2k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 86
Contributor 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 86/100
ionic-team/ionic-docs#4705 ·
-
content package: angular
Difficulty 2/5 Half a day Newbie friendliness 78/100
ionic-team/ionic-docs#4702 ·
-
triage
Difficulty 1/5 Under an hour Newbie friendliness 80/100
ionic-team/ionic-docs#4546 ·
-
content: broken link Opencontent
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
ionic-team/ionic-docs#4381 · 2 comments ·
-
triage
Difficulty 1/5 Under an hour Newbie friendliness 72/100
ionic-team/ionic-docs#3639 ·
All issues in ionic-team/ionic-docs
Similar issues
-
sync-en
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
agilepathway/label-checker#640 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
BasedHardware/omi#15662 · 1 comment ·
-
documentation help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
-
Difficulty 1/5 1-3 hours Newbie friendliness 88/100