-
Notifications
You must be signed in to change notification settings - Fork 13.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: focus trap prevents focus from moving to overlays that do not use focus trapping #24646
bug: focus trap prevents focus from moving to overlays that do not use focus trapping #24646
Comments
I have created a simple reproduction of this issue. It appears if an ion-segment exists in the modal, any nested modal inputs cannot grab focus. Stackblitz of ion-modal with an ion-segment present and tinyMCE editor
Stackblitz of ion-modal without an ion-segment present and tinyMCE editor
|
I have the same problem with ngx-mat-select-search inside modal. I have made an example where outside modal the input search of select works, but inside modal without an ion-segment i can't search select values. https://stackblitz.com/edit/modal-without-segment-rhkczi?file=src/app/app.component.html |
This appears to be an issue with focus trapping. When you present |
Is there a workaround to this issue? I'm using TinyMCE in an Ionic 7 project, the plugin dialogs (e.g. the TinyMCE Link Plugin) work fine on ionic pages, but not when I use an editor inside an ion-modal. Focus trapping! None of the input elements are focusable. Any ideas how I can get around this? |
- ion-modal traps focus inside the modal making controls like autocomplete unusable inside it: ionic-team/ionic-framework#24646 - add a custom ion-modal that disables backdrop using backdrop-breakpoint=1 and we add a custom IonModalBackdrop in the parent component
Regarding the recent closed issue #29056, is there a recomended way to avoid the focus trap on modal? |
Thanks in my case, adding it using cssClass did not work for me, but adding it using an id before opening the modal worked perfectly for me. |
Would it make sense in the ModalController object's configuration API to have a boolean to activate or not the focus trap? Something like:
|
Hi everyone, I have a dev build with a proposed feature to resolve this if anyone is interested in testing: Note that this is an Ionic 8 dev build and is subject to the Ionic 8 breaking changes list. To disable focus trapping, set the |
Hi @liamdebeasi I will try to test it latter on. My project in currently on version 7 so i will have to check what needs to be done to upgrade to version 8. |
I have tested it with ngx-mat-select-search and it is fine. https://stackblitz.com/edit/angular-4fujbn?file=src%2Fapp%2Fapp.component.html Thanks. |
I only had the opportunity to test it now. To this: No problems at all. ;) But taking as an example by just disabling the focus trap when activating a certain component (dropdown) within the modal.
Would there be any way to modify the focusTrap prop in this context? |
In this case you could do something like Alternatively, you could pass a prop to the modal component that toggles |
Thanks for the issue. This has been resolved via #29379, and a fix will be available in an upcoming release of Ionic Framework. |
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out. |
Prerequisites
Ionic Framework Version
Current Behavior
I can not focus on search bar input for the "ngx-mat-select-search" or all inputs that they are using to add features such as add link in the MCE Editor when I am using them (mat-select / MCE-Editor) in the ionic-modal.
I thought it was for z-index conflicting and try different ways to solve it but I could not!
Expected Behavior
The end-user should be type anything in the inputs that I explained on the top.
Steps to Reproduce
.
Code Reproduction URL
No response
Ionic Info
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: