-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Description
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
v7.6.2
Current Behavior
For both the inline and controller-based modal, setting keyboardClose to false results in a lack of focus trapping inside the modal. Focus remains on the trigger element and subsequent tabs will traverse through the tabbable elements behind the modal.
Furthermore this leads to applications needing to guard against accidentally instantiating multiple modals on top of each other when using the ModalController. Users might press enter/space repeatedly and unknowingly instantate many modals as they are not immediately discoverable.
Expected Behavior
I expect to be able to immediately tab to the cancel button of the modal once the modal is opened, and cycle through only the elements inside the modal when tabbing.
Steps to Reproduce
- clone, install and serve: https://github.com/RasmusKjeldgaard/ionic-modal-keyboardClose-repro
- Alternatively this stackblitz with a minor tweak to the default docs example can be used for quick verification
- tab to or click on the 'open' button so the modal opens
- tab again and see that focus still behind the modal
Code Reproduction URL
https://github.com/RasmusKjeldgaard/ionic-modal-keyboardClose-repro
Ionic Info
Ionic:
Ionic CLI : 7.1.1 (/Users/rkjeldgaard/.nvm/versions/node/v18.13.0/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 7.6.2
@angular-devkit/build-angular : 17.0.8
@angular-devkit/schematics : 17.0.8
@angular/cli : 17.0.8
@ionic/angular-toolkit : 9.0.0
Capacitor:
Capacitor CLI : 5.6.0
@capacitor/android : not installed
@capacitor/core : 5.6.0
@capacitor/ios : not installed
Utility:
cordova-res : not installed globally
native-run : 2.0.0
System:
NodeJS : v18.13.0 (/Users/rkjeldgaard/.nvm/versions/node/v18.13.0/bin/node)
npm : 8.19.3
OS : macOS Unknown
Additional Information
No response