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.
The selector used to force focus on the close button (per ARIA guidelines) is not scoped to the modal content. The result is that when you have another element with the "close" class on the page, it also receives focus. This causes the modal offset to be incorrect since the other elements with the "close" class are scrolled into view.
Comment | File | Size | Author |
---|---|---|---|
#11 | interdiff.txt | 659 bytes | joelpittet |
#11 | 2607626-11.patch | 2.39 KB | joelpittet |
Comments
Comment #2
mdeltito CreditAttribution: mdeltito at Phase2 commentedComment #3
nicobot CreditAttribution: nicobot as a volunteer commentedIt works for me.
Comment #4
capynet CreditAttribution: capynet as a volunteer commentedIt works for me too.
tnx!
Comment #5
dsnopekHere's a version of this that also scopes to the
.modal-header
selector (since there can be elements with the "close" class in the modal body, not just the close button in the header) and makes sure to onlyunbind()
on the correct elements (although, this is just a performance improvement, it should be harmless to unbind an event that was never bound).Comment #6
dsnopekWe're using this patch in Panopoly.
Comment #7
joelpittet@dsnopek your patch in #2 looked better to me. Checking the
.modal-header
is good though.modalContent
=$('#modalContent')
, though using the reference can help not parse the DOM as much.How about:
var $modalHeader = modalContent.find('.modal-header');
$('.close', $modalHeader)
Comment #8
dsnopekI'm not opposed to that! :-)
Comment #9
joelpittetHow's this?
Comment #10
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedI could not close modals in panels
modal.js?ocrnxd:680 Uncaught ReferenceError: $modalContent is not definedDrupal.CTools.Modal.unmodalContent @ modal.js?ocrnxd:680
Drupal.CTools.Modal.dismiss @ oa_basetheme.modal.js?ocrnxd:117Drupal.CTools.Modal.modal_dismiss @ modal.js?ocrnxd:333Drupal.ajax.success @ ajax.js?v=7.50:428success @ ajax.js?v=7.50:189c.success @ jquery.form.min.js?v=2.69:11o @ jquery.min.js?v=1.7.2:2fireWith @ jquery.min.js?v=1.7.2:2w @ jquery.min.js?v=1.7.2:4d @ jquery.min.js?v=1.7.2:4
Comment #11
joelpittetThanks for testing @SocialNicheGuru, I missed something it looks like. Here's the missing variable.
Comment #12
joelpittetComment #13
rivimeyPatch in #11 applies cleanly to 7.x-1.x and looks good to me.
More +1 responses to #11 would be helpful (@dsnopek?), but I think this one is good to go.
Comment #14
joelpittetFeel free to change the status to "reviewed and tested by the community" if it's working for you, that would help it get in
Comment #15
rivimeyProposing RTBC - slightly reluctantly because there are no 'corroborating' comments, but as far as I can see this should be a good change.
Comment #16
joelpittetThanks, I'm sure if the maintainers have any concern they will knock it back to needs work, so there is at least 3 people who have reviewed and tested it.
Comment #17
DamienMcKennaComment #18
japerryThe best way to test code is to deploy code. ;)
Since this is a relatively small patch, Committed.