Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I notice that I can escape a modal with exit, but it leaves the .modal-open class on the body such that the scrolling is locked. I also notice that I can't click elsewhere on the body to close the modal either like I think you can with regular bootstrap modals. To test, open a modal and then click ESC. the modal will be gone, but you can't scroll.
Comment | File | Size | Author |
---|---|---|---|
#5 | bootstrap-modal-esc-2411495-5.patch | 755 bytes | joelstein |
#3 | bootstrap-modal-esc-2411495-3.patch | 685 bytes | DuaelFr |
#1 | bootstrap-modal-esc-2411495-1.patch | 584 bytes | frankcarey |
Comments
Comment #1
frankcarey CreditAttribution: frankcarey commentedHere is a patch that overrides the ctools handler for ESC. Basically a 1:1 copy from ctools, but uses the dismiss function instead of close().
Comment #2
adamsro CreditAttribution: adamsro commentedWorks well for me. Thanks for posting this.
Comment #3
DuaelFrI think I came up with a more elegant solution.
It only relies on a event declared by CTools and removes the need to rewrite
Drupal.CTools.Modal.dismiss
or to bind a new general keypress event.Comment #4
markhalliwellSorry bout this. Since the commits in this related issue, this file no longer exists. The plan is to start over with modals completely, using the library extends/overrides where necessary. Also, considering the currently low 8.x CTools usage, I'm inclined to simply add this back in with a separate issue if/when it's ever needed.
Comment #5
joelstein CreditAttribution: joelstein as a volunteer commentedThis issue also exists in Drupal 7. Can we at least get it fixed there with the patch from #3? Re-rolled here against 7.x-3.x-dev.
Comment #6
markhalliwellComment #7
joelstein CreditAttribution: joelstein as a volunteer commentedNo fix for D7? No explanation? Should I have posted this in a new issue?
Comment #8
markhalliwellHm, I'm not sure why my comment didn't show. But basically I said:
Please don't hi-jack closed issues, especially ones pertaining to different code/branches. There is a reason why we have a "Related issues" field. Create a new issue that references the existing closed issue.
Comment #9
joelstein CreditAttribution: joelstein as a volunteer commentedOkey dokey. D7 issue: #2655262: Modal doesn't release scroll lock when using ESC to exit (D7)